From 30ba3429a02384007ec45e95db462a07d6a8e892 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:05:21 +0000 Subject: [PATCH 01/21] chore: go live (#6) --- .github/workflows/publish-sonatype.yml | 2 +- .gitignore | 1 + .stats.yml | 2 +- README.md | 10 +- build.gradle.kts | 14 +- buildSrc/build.gradle.kts | 4 - .../src/main/kotlin/openlayer.java.gradle.kts | 14 +- .../main/kotlin/openlayer.kotlin.gradle.kts | 1 - .../main/kotlin/openlayer.publish.gradle.kts | 83 +- .../api}/client/okhttp/OkHttpClient.kt | 16 +- .../client/okhttp/OpenlayerOkHttpClient.kt | 8 +- .../okhttp/OpenlayerOkHttpClientAsync.kt | 8 +- .../openlayer/api}/client/OpenlayerClient.kt | 6 +- .../api}/client/OpenlayerClientAsync.kt | 6 +- .../api}/client/OpenlayerClientAsyncImpl.kt | 16 +- .../api}/client/OpenlayerClientImpl.kt | 16 +- .../openlayer/api}/core/BaseDeserializer.kt | 2 +- .../openlayer/api}/core/BaseSerializer.kt | 2 +- .../openlayer/api}/core/ClientOptions.kt | 6 +- .../openlayer/api}/core/ObjectMappers.kt | 2 +- .../openlayer/api}/core/Properties.kt | 2 +- .../openlayer/api}/core/RequestOptions.kt | 2 +- .../openlayer/api}/core/Utils.kt | 4 +- .../openlayer/api}/core/Values.kt | 4 +- .../api}/core/http/BinaryResponseContent.kt | 2 +- .../openlayer/api}/core/http/HttpClient.kt | 4 +- .../openlayer/api}/core/http/HttpMethod.kt | 2 +- .../openlayer/api}/core/http/HttpRequest.kt | 4 +- .../api}/core/http/HttpRequestBody.kt | 2 +- .../openlayer/api}/core/http/HttpResponse.kt | 2 +- .../api}/core/http/RetryingHttpClient.kt | 6 +- .../api}/errors/BadRequestException.kt | 2 +- .../api}/errors/InternalServerException.kt | 2 +- .../api}/errors/NotFoundException.kt | 2 +- .../openlayer/api}/errors/OpenlayerError.kt | 8 +- .../api}/errors/OpenlayerException.kt | 2 +- .../errors/OpenlayerInvalidDataException.kt | 2 +- .../api}/errors/OpenlayerIoException.kt | 2 +- .../api}/errors/OpenlayerServiceException.kt | 2 +- .../api}/errors/PermissionDeniedException.kt | 2 +- .../api}/errors/RateLimitException.kt | 2 +- .../api}/errors/UnauthorizedException.kt | 2 +- .../errors/UnexpectedStatusCodeException.kt | 2 +- .../errors/UnprocessableEntityException.kt | 2 +- .../api}/models/CommitTestResultListParams.kt | 16 +- .../models/CommitTestResultListResponse.kt | 24 +- .../InferencePipelineDataStreamParams.kt | 24 +- .../InferencePipelineDataStreamResponse.kt | 18 +- .../InferencePipelineTestResultListParams.kt | 16 +- ...InferencePipelineTestResultListResponse.kt | 24 +- .../api}/models/ProjectCommitListParams.kt | 10 +- .../api}/models/ProjectCommitListResponse.kt | 18 +- .../api/models/ProjectCreateParams.kt | 817 ++++++++++++ .../api/models/ProjectCreateResponse.kt | 1092 +++++++++++++++++ .../ProjectInferencePipelineCreateParams.kt | 573 +++++++++ .../ProjectInferencePipelineCreateResponse.kt | 733 +++++++++++ .../ProjectInferencePipelineListParams.kt | 10 +- .../ProjectInferencePipelineListResponse.kt | 18 +- .../api}/models/ProjectListParams.kt | 16 +- .../api}/models/ProjectListResponse.kt | 18 +- .../openlayer/api}/services/Handlers.kt | 28 +- .../api}/services/HttpRequestBodies.kt | 12 +- .../api}/services/async/CommitServiceAsync.kt | 4 +- .../services/async/CommitServiceAsyncImpl.kt | 14 +- .../async/InferencePipelineServiceAsync.kt | 6 +- .../InferencePipelineServiceAsyncImpl.kt | 20 +- .../api/services/async/ProjectServiceAsync.kt | 35 + .../services/async/ProjectServiceAsyncImpl.kt | 100 ++ .../async/commits/TestResultServiceAsync.kt | 8 +- .../commits/TestResultServiceAsyncImpl.kt | 24 +- .../inferencePipelines/DataServiceAsync.kt | 8 +- .../DataServiceAsyncImpl.kt | 26 +- .../TestResultServiceAsync.kt | 8 +- .../TestResultServiceAsyncImpl.kt | 24 +- .../async/projects/CommitServiceAsync.kt | 8 +- .../async/projects/CommitServiceAsyncImpl.kt | 24 +- .../projects/InferencePipelineServiceAsync.kt | 29 + .../InferencePipelineServiceAsyncImpl.kt | 88 ++ .../api}/services/blocking/CommitService.kt | 4 +- .../services/blocking/CommitServiceImpl.kt | 14 +- .../blocking/InferencePipelineService.kt | 6 +- .../blocking/InferencePipelineServiceImpl.kt | 20 +- .../api/services/blocking/ProjectService.kt | 34 + .../services/blocking/ProjectServiceImpl.kt | 97 ++ .../blocking/commits/TestResultService.kt | 8 +- .../blocking/commits/TestResultServiceImpl.kt | 24 +- .../inferencePipelines/DataService.kt | 8 +- .../inferencePipelines/DataServiceImpl.kt | 26 +- .../inferencePipelines/TestResultService.kt | 8 +- .../TestResultServiceImpl.kt | 24 +- .../blocking/projects/CommitService.kt | 8 +- .../blocking/projects/CommitServiceImpl.kt | 24 +- .../projects/InferencePipelineService.kt | 28 + .../projects/InferencePipelineServiceImpl.kt | 85 ++ .../services/async/ProjectServiceAsync.kt | 26 - .../services/async/ProjectServiceAsyncImpl.kt | 67 - .../projects/InferencePipelineServiceAsync.kt | 20 - .../InferencePipelineServiceAsyncImpl.kt | 54 - .../services/blocking/ProjectService.kt | 25 - .../services/blocking/ProjectServiceImpl.kt | 65 - .../projects/InferencePipelineService.kt | 19 - .../projects/InferencePipelineServiceImpl.kt | 52 - .../openlayer/api}/TestServerExtension.kt | 2 +- .../api}/client/OpenlayerClientTest.kt | 2 +- .../api}/core/http/HttpRequestTest.kt | 2 +- .../api}/core/http/RetryingHttpClientTest.kt | 4 +- .../api}/core/http/SerializerTest.kt | 4 +- .../models/CommitTestResultListParamsTest.kt | 4 +- .../CommitTestResultListResponseTest.kt | 4 +- .../InferencePipelineDataStreamParamsTest.kt | 6 +- ...InferencePipelineDataStreamResponseTest.kt | 2 +- ...ferencePipelineTestResultListParamsTest.kt | 4 +- ...rencePipelineTestResultListResponseTest.kt | 4 +- .../models/ProjectCommitListParamsTest.kt | 4 +- .../models/ProjectCommitListResponseTest.kt | 2 +- .../api/models/ProjectCreateParamsTest.kt | 106 ++ .../api/models/ProjectCreateResponseTest.kt | 109 ++ ...rojectInferencePipelineCreateParamsTest.kt | 66 + ...jectInferencePipelineCreateResponseTest.kt | 77 ++ .../ProjectInferencePipelineListParamsTest.kt | 4 +- ...rojectInferencePipelineListResponseTest.kt | 2 +- .../api}/models/ProjectListParamsTest.kt | 4 +- .../api}/models/ProjectListResponseTest.kt | 2 +- .../api}/services/ErrorHandlingTest.kt | 34 +- .../api}/services/ServiceParamsTest.kt | 14 +- .../services/blocking/CommitServiceTest.kt | 6 +- .../blocking/InferencePipelineServiceTest.kt | 6 +- .../services/blocking/ProjectServiceTest.kt | 74 ++ .../blocking/commits/TestResultServiceTest.kt | 8 +- .../inferencePipelines/DataServiceTest.kt | 10 +- .../TestResultServiceTest.kt | 8 +- .../blocking/projects/CommitServiceTest.kt | 8 +- .../projects/InferencePipelineServiceTest.kt | 56 + .../services/blocking/ProjectServiceTest.kt | 34 - .../projects/InferencePipelineServiceTest.kt | 34 - 135 files changed, 4729 insertions(+), 901 deletions(-) rename openlayer-java-client-okhttp/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/okhttp/OkHttpClient.kt (93%) rename openlayer-java-client-okhttp/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/okhttp/OpenlayerOkHttpClient.kt (93%) rename openlayer-java-client-okhttp/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/okhttp/OpenlayerOkHttpClientAsync.kt (93%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/OpenlayerClient.kt (75%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/OpenlayerClientAsync.kt (76%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/OpenlayerClientAsyncImpl.kt (75%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/client/OpenlayerClientImpl.kt (74%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/BaseDeserializer.kt (98%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/BaseSerializer.kt (85%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/ClientOptions.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/ObjectMappers.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/Properties.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/RequestOptions.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/Utils.kt (93%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/Values.kt (99%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/BinaryResponseContent.kt (88%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/HttpClient.kt (83%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/HttpMethod.kt (77%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/HttpRequest.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/HttpRequestBody.kt (94%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/HttpResponse.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/core/http/RetryingHttpClient.kt (98%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/BadRequestException.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/InternalServerException.kt (91%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/NotFoundException.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/OpenlayerError.kt (92%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/OpenlayerException.kt (81%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/OpenlayerInvalidDataException.kt (82%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/OpenlayerIoException.kt (81%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/OpenlayerServiceException.kt (91%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/PermissionDeniedException.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/RateLimitException.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/UnauthorizedException.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/UnexpectedStatusCodeException.kt (91%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/errors/UnprocessableEntityException.kt (90%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/CommitTestResultListParams.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/CommitTestResultListResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineDataStreamParams.kt (99%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineDataStreamResponse.kt (92%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineTestResultListParams.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineTestResultListResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectCommitListParams.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectCommitListResponse.kt (99%) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectInferencePipelineListParams.kt (97%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectInferencePipelineListResponse.kt (98%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectListParams.kt (96%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectListResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/Handlers.kt (84%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/HttpRequestBodies.kt (93%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/CommitServiceAsync.kt (67%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/CommitServiceAsyncImpl.kt (54%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/InferencePipelineServiceAsync.kt (57%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/InferencePipelineServiceAsyncImpl.kt (52%) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/commits/TestResultServiceAsync.kt (69%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/commits/TestResultServiceAsyncImpl.kt (72%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/inferencePipelines/DataServiceAsync.kt (68%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/inferencePipelines/DataServiceAsyncImpl.kt (71%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/inferencePipelines/TestResultServiceAsync.kt (67%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt (71%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/projects/CommitServiceAsync.kt (69%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/async/projects/CommitServiceAsyncImpl.kt (72%) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/CommitService.kt (65%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/CommitServiceImpl.kt (52%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/InferencePipelineService.kt (56%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/InferencePipelineServiceImpl.kt (50%) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/commits/TestResultService.kt (66%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/commits/TestResultServiceImpl.kt (70%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/inferencePipelines/DataService.kt (64%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/inferencePipelines/DataServiceImpl.kt (70%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/inferencePipelines/TestResultService.kt (63%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/inferencePipelines/TestResultServiceImpl.kt (70%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/projects/CommitService.kt (65%) rename openlayer-java-core/src/main/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/projects/CommitServiceImpl.kt (70%) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsync.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsyncImpl.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsync.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsyncImpl.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectService.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectServiceImpl.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineService.kt delete mode 100644 openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceImpl.kt rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/TestServerExtension.kt (98%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/client/OpenlayerClientTest.kt (71%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/core/http/HttpRequestTest.kt (95%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/core/http/RetryingHttpClientTest.kt (98%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/core/http/SerializerTest.kt (98%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/CommitTestResultListParamsTest.kt (97%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/CommitTestResultListResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineDataStreamParamsTest.kt (98%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineDataStreamResponseTest.kt (95%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineTestResultListParamsTest.kt (97%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/InferencePipelineTestResultListResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectCommitListParamsTest.kt (95%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectCommitListResponseTest.kt (99%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectInferencePipelineListParamsTest.kt (96%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectInferencePipelineListResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectListParamsTest.kt (95%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/models/ProjectListResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/ErrorHandlingTest.kt (97%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/ServiceParamsTest.kt (93%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/CommitServiceTest.kt (58%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/InferencePipelineServiceTest.kt (59%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/commits/TestResultServiceTest.kt (84%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/inferencePipelines/DataServiceTest.kt (90%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/inferencePipelines/TestResultServiceTest.kt (85%) rename openlayer-java-core/src/test/kotlin/{org/openlayer => com/openlayer/api}/services/blocking/projects/CommitServiceTest.kt (81%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/ProjectServiceTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceTest.kt diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index fbc52d2..7dd499b 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -30,7 +30,7 @@ jobs: - name: Publish to Sonatype run: | - ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" + ./gradlew --parallel --no-daemon publish env: SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/.gitignore b/.gitignore index 1c94d9f..39c31e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.prism.log .gradle .idea build diff --git a/.stats.yml b/.stats.yml index 2b7dbf3..699660e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 6 +configured_endpoints: 8 diff --git a/README.md b/README.md index c027e07..4a4d0de 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/org.openlayer/openlayer-java)](https://central.sonatype.com/artifact/org.openlayer/openlayer-java/0.1.0-alpha.1) +[![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.1) @@ -27,14 +27,14 @@ The REST API documentation can be foundĀ [on openlayer.com](https://openlayer.co ```kotlin -implementation("org.openlayer:openlayer-java:0.1.0-alpha.1") +implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.1") ``` #### Maven ```xml - org.openlayer + com.openlayer.api openlayer-java 0.1.0-alpha.1 @@ -72,9 +72,9 @@ To create a new inference pipeline data, first use the `InferencePipelineDataStr then pass that to the `stream` method of the `data` service. ```java +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; import java.util.List; -import org.openlayer.models.InferencePipelineDataStreamParams; -import org.openlayer.models.InferencePipelineDataStreamResponse; InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() .rows(List.of(InferencePipelineDataStreamParams.Row.builder().build())) diff --git a/build.gradle.kts b/build.gradle.kts index 4cac40f..1f51e8e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,20 @@ plugins { - + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" } allprojects { - group = "org.openlayer" + group = "com.openlayer.api" version = "0.1.0-alpha.1" // x-release-please-version } +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + username.set(System.getenv("SONATYPE_USERNAME")) + password.set(System.getenv("SONATYPE_PASSWORD")) + } + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 493cb32..b88cd06 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,16 +1,12 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "1.9.22" - id("com.vanniktech.maven.publish") version "0.28.0" } repositories { gradlePluginPortal() - mavenCentral() } dependencies { implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") - 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 53e6330..bc01a1d 100644 --- a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts @@ -1,9 +1,6 @@ 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 +import java.util.Locale plugins { `java-library` @@ -14,6 +11,11 @@ repositories { mavenCentral() } +configure { + withJavadocJar() + withSourcesJar() +} + configure { java { importOrder() @@ -33,6 +35,10 @@ tasks.withType().configureEach { options.release.set(8) } +tasks.named("javadocJar") { + setZip64(true) +} + tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index 5c12826..d5a6d5d 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") diff --git a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts index d159a4f..1179c4d 100644 --- a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts @@ -3,52 +3,65 @@ 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 plugins { - id("com.vanniktech.maven.publish") + `maven-publish` + `signing` } -repositories { - gradlePluginPortal() - mavenCentral() -} +configure { + publications { + register("maven") { + from(components["java"]) -extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") -extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") -extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") + pom { + name.set("Openlayer API") + description.set("API for interacting with the Openlayer server.") + url.set("https://openlayer.com/docs/api-reference/rest/overview") -configure { - signAllPublications() - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + licenses { + license { + name.set("Apache-2.0") + } + } - this.coordinates(project.group.toString(), project.name, project.version.toString()) + developers { + developer { + name.set("Openlayer") + email.set("support@openlayer.com") + } + } - pom { - name.set("Openlayer API") - description.set("API for interacting with the Openlayer server.") - url.set("https://openlayer.com/docs/api-reference/rest/overview") + scm { + connection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") + developerConnection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") + url.set("https://github.com/openlayer-ai/openlayer-java") + } - licenses { - license { - name.set("Apache-2.0") - } - } - - developers { - developer { - name.set("Openlayer") - email.set("support@openlayer.com") + versionMapping { + allVariants { + fromResolutionResult() + } + } } } + } +} - scm { - connection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") - developerConnection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") - url.set("https://github.com/openlayer-ai/openlayer-java") - } +signing { + val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } + val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } + val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } + if (signingKey != null && signingPassword != null) { + useInMemoryPgpKeys( + signingKeyId, + signingKey, + signingPassword, + ) + sign(publishing.publications["maven"]) } } + +tasks.named("publish") { + dependsOn(":closeAndReleaseSonatypeStagingRepository") +} diff --git a/openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt similarity index 93% rename from openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OkHttpClient.kt rename to openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt index bfa04c9..13779b0 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt @@ -1,7 +1,14 @@ -package org.openlayer.client.okhttp +package com.openlayer.api.client.okhttp import com.google.common.collect.ListMultimap import com.google.common.collect.MultimapBuilder +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpRequestBody +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.io.InputStream import java.net.Proxy @@ -19,13 +26,6 @@ import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response import okio.BufferedSink -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpClient -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpRequestBody -import org.openlayer.core.http.HttpResponse -import org.openlayer.errors.OpenlayerIoException class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) : diff --git a/openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt similarity index 93% rename from openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OpenlayerOkHttpClient.kt rename to openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index ad640c1..1dff803 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.client.okhttp +package com.openlayer.api.client.okhttp 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 java.net.Proxy import java.time.Clock import java.time.Duration -import org.openlayer.client.OpenlayerClient -import org.openlayer.client.OpenlayerClientImpl -import org.openlayer.core.ClientOptions class OpenlayerOkHttpClient private constructor() { diff --git a/openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt similarity index 93% rename from openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OpenlayerOkHttpClientAsync.kt rename to openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index 1a33a1c..0866f95 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/org/openlayer/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.client.okhttp +package com.openlayer.api.client.okhttp 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 java.net.Proxy import java.time.Clock import java.time.Duration -import org.openlayer.client.OpenlayerClientAsync -import org.openlayer.client.OpenlayerClientAsyncImpl -import org.openlayer.core.ClientOptions class OpenlayerOkHttpClientAsync private constructor() { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt similarity index 75% rename from openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClient.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index 916c328..1f528fc 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -2,10 +2,10 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.client +package com.openlayer.api.client -import org.openlayer.models.* -import org.openlayer.services.blocking.* +import com.openlayer.api.models.* +import com.openlayer.api.services.blocking.* interface OpenlayerClient { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt similarity index 76% rename from openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index 38f2d7e..57d71e1 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -2,10 +2,10 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.client +package com.openlayer.api.client -import org.openlayer.models.* -import org.openlayer.services.async.* +import com.openlayer.api.models.* +import com.openlayer.api.services.async.* interface OpenlayerClientAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt similarity index 75% rename from openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index 2b4bbce..a6a4ee6 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.client - -import org.openlayer.core.ClientOptions -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.* -import org.openlayer.services.async.* -import org.openlayer.services.errorHandler +package com.openlayer.api.client + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.* +import com.openlayer.api.services.async.* +import com.openlayer.api.services.errorHandler class OpenlayerClientAsyncImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt similarity index 74% rename from openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index 7f1a32e..e8378b1 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.client - -import org.openlayer.core.ClientOptions -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.* -import org.openlayer.services.blocking.* -import org.openlayer.services.errorHandler +package com.openlayer.api.client + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.* +import com.openlayer.api.services.blocking.* +import com.openlayer.api.services.errorHandler class OpenlayerClientImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/BaseDeserializer.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/BaseDeserializer.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt index e2344e5..0573e16 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/BaseDeserializer.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt @@ -1,4 +1,4 @@ -package org.openlayer.core +package com.openlayer.api.core import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.ObjectCodec diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/BaseSerializer.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseSerializer.kt similarity index 85% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/BaseSerializer.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseSerializer.kt index d3031ef..eb87e2c 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/BaseSerializer.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseSerializer.kt @@ -1,4 +1,4 @@ -package org.openlayer.core +package com.openlayer.api.core import com.fasterxml.jackson.databind.ser.std.StdSerializer import kotlin.reflect.KClass diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/ClientOptions.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index d3434c8..ed353b4 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.core +package com.openlayer.api.core import com.fasterxml.jackson.databind.json.JsonMapper import com.google.common.collect.ArrayListMultimap import com.google.common.collect.ListMultimap +import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.core.http.RetryingHttpClient import java.time.Clock -import org.openlayer.core.http.HttpClient -import org.openlayer.core.http.RetryingHttpClient class ClientOptions private constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/ObjectMappers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/ObjectMappers.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt index 5c86b9e..2a22f38 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/ObjectMappers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt @@ -1,6 +1,6 @@ @file:JvmName("ObjectMappers") -package org.openlayer.core +package com.openlayer.api.core import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.DeserializationFeature diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/Properties.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/Properties.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt index d057b2f..bc0d02a 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/Properties.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt @@ -1,6 +1,6 @@ @file:JvmName("Properties") -package org.openlayer.core +package com.openlayer.api.core import java.util.Properties diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/RequestOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/RequestOptions.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt index 2afeccc..2b862a3 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/RequestOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt @@ -1,4 +1,4 @@ -package org.openlayer.core +package com.openlayer.api.core import java.time.Duration diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/Utils.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt similarity index 93% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/Utils.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt index a7ca7ec..8f46e25 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/Utils.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt @@ -1,12 +1,12 @@ @file:JvmName("Utils") -package org.openlayer.core +package com.openlayer.api.core import com.google.common.collect.ImmutableListMultimap import com.google.common.collect.ListMultimap import com.google.common.collect.Multimaps +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Collections -import org.openlayer.errors.OpenlayerInvalidDataException @JvmSynthetic internal fun T?.getOrThrow(name: String): T { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/Values.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index b89c39b..12b454f 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -1,4 +1,4 @@ -package org.openlayer.core +package com.openlayer.api.core import com.fasterxml.jackson.annotation.JacksonAnnotationsInside import com.fasterxml.jackson.annotation.JsonAutoDetect @@ -26,11 +26,11 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.OBJECT 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.util.Objects import java.util.Optional import org.apache.hc.core5.http.ContentType -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(using = JsonField.Deserializer::class) sealed class JsonField { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/BinaryResponseContent.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt similarity index 88% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/BinaryResponseContent.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt index 852939a..4c099ff 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/BinaryResponseContent.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt @@ -1,4 +1,4 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http import java.io.Closeable import java.io.IOException diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt similarity index 83% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpClient.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt index 354581b..b9cac17 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt @@ -1,8 +1,8 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http +import com.openlayer.api.core.RequestOptions import java.io.Closeable import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions interface HttpClient : Closeable { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpMethod.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpMethod.kt similarity index 77% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpMethod.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpMethod.kt index 53afed9..f029948 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpMethod.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpMethod.kt @@ -1,4 +1,4 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http enum class HttpMethod { GET, diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpRequest.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpRequest.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt index 3f30a60..243c19a 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpRequest.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt @@ -1,10 +1,10 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http import com.google.common.collect.ArrayListMultimap import com.google.common.collect.ListMultimap import com.google.common.collect.Multimap import com.google.common.collect.MultimapBuilder -import org.openlayer.core.toUnmodifiable +import com.openlayer.api.core.toUnmodifiable class HttpRequest private constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpRequestBody.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt similarity index 94% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpRequestBody.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt index e85338d..4f4dbd1 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpRequestBody.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt @@ -1,4 +1,4 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http import java.io.Closeable import java.io.IOException diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt index 8f50461..c4c2f92 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/HttpResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt @@ -1,4 +1,4 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http import com.google.common.collect.ListMultimap import java.io.Closeable diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/RetryingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/org/openlayer/core/http/RetryingHttpClient.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt index 4f33c10..a90d6f4 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/core/http/RetryingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt @@ -1,8 +1,10 @@ @file:JvmSynthetic -package org.openlayer.core.http +package com.openlayer.api.core.http import com.google.common.util.concurrent.MoreExecutors +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.time.Clock import java.time.Duration @@ -19,8 +21,6 @@ import java.util.concurrent.TimeUnit import java.util.function.Function import kotlin.math.min import kotlin.math.pow -import org.openlayer.core.RequestOptions -import org.openlayer.errors.OpenlayerIoException class RetryingHttpClient private constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/BadRequestException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/BadRequestException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt index 0e7c4a5..f51b5d2 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/BadRequestException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/InternalServerException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt similarity index 91% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/InternalServerException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt index fab7f30..b0c6a67 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/InternalServerException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/NotFoundException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/NotFoundException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt index eaf39a8..9efe856 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/NotFoundException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt similarity index 92% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerError.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index 0edb21a..59250fe 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.errors +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.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable import java.util.Objects -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable @JsonDeserialize(builder = OpenlayerError.Builder::class) @NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerException.kt similarity index 81% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerException.kt index 29dd500..741adba 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors open class OpenlayerException @JvmOverloads diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerInvalidDataException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerInvalidDataException.kt similarity index 82% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerInvalidDataException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerInvalidDataException.kt index aaaaa7f..e576549 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerInvalidDataException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerInvalidDataException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors class OpenlayerInvalidDataException @JvmOverloads diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerIoException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerIoException.kt similarity index 81% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerIoException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerIoException.kt index 4cefedf..23217df 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerIoException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerIoException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors class OpenlayerIoException @JvmOverloads diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerServiceException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt similarity index 91% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerServiceException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt index 39024b5..916e4ed 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/OpenlayerServiceException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/PermissionDeniedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/PermissionDeniedException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt index 88acfb1..cc7f0d6 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/PermissionDeniedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/RateLimitException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/RateLimitException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt index 3abc49b..5b83fd0 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/RateLimitException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnauthorizedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnauthorizedException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt index 8e5ea1d..f0e8f0f 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnauthorizedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnexpectedStatusCodeException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt similarity index 91% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnexpectedStatusCodeException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt index 083edeb..30e8d3a 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnexpectedStatusCodeException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnprocessableEntityException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnprocessableEntityException.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt index 32c5117..87dba98 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/errors/UnprocessableEntityException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt @@ -1,4 +1,4 @@ -package org.openlayer.errors +package com.openlayer.api.errors import com.google.common.collect.ListMultimap diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/CommitTestResultListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index 8f36b3d..5337a3c 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -import org.openlayer.core.Enum -import org.openlayer.core.JsonField -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException -import org.openlayer.models.* class CommitTestResultListParams constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/CommitTestResultListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index 04127f0..731f3b5 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -13,20 +13,20 @@ 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.NoAutoDetect +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -import org.openlayer.core.BaseDeserializer -import org.openlayer.core.BaseSerializer -import org.openlayer.core.Enum -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.getOrThrow -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = CommitTestResultListResponse.Builder::class) @NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineDataStreamParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index 759d243..3efe054 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -12,19 +12,19 @@ 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.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.getOrThrow +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -import org.openlayer.core.BaseDeserializer -import org.openlayer.core.BaseSerializer -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.getOrThrow -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException -import org.openlayer.models.* class InferencePipelineDataStreamParams constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt similarity index 92% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineDataStreamResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index 3ecfc52..087ceda 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects -import org.openlayer.core.Enum -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) @NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineTestResultListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index 36afe62..cb8fb3c 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -import org.openlayer.core.Enum -import org.openlayer.core.JsonField -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException -import org.openlayer.models.* class InferencePipelineTestResultListParams constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineTestResultListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index a11dfed..045ce71 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -13,20 +13,20 @@ 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.NoAutoDetect +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -import org.openlayer.core.BaseDeserializer -import org.openlayer.core.BaseSerializer -import org.openlayer.core.Enum -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.getOrThrow -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = InferencePipelineTestResultListResponse.Builder::class) @NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectCommitListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index 5b862ce..6951d52 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.models.* class ProjectCommitListParams constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectCommitListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index e75be66..da9d1fd 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -1,23 +1,23 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -import org.openlayer.core.Enum -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = ProjectCommitListResponse.Builder::class) @NoAutoDetect 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 new file mode 100644 index 0000000..7feaef8 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -0,0 +1,817 @@ +// 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.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.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +class ProjectCreateParams +constructor( + private val name: String, + private val taskType: TaskType, + private val description: String?, + private val gitRepo: GitRepo?, + private val slackChannelId: String?, + private val slackChannelName: String?, + private val slackChannelNotificationsEnabled: Boolean?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun name(): String = name + + fun taskType(): TaskType = taskType + + fun description(): Optional = Optional.ofNullable(description) + + fun gitRepo(): Optional = Optional.ofNullable(gitRepo) + + fun slackChannelId(): Optional = Optional.ofNullable(slackChannelId) + + fun slackChannelName(): Optional = Optional.ofNullable(slackChannelName) + + fun slackChannelNotificationsEnabled(): Optional = + Optional.ofNullable(slackChannelNotificationsEnabled) + + @JvmSynthetic + internal fun getBody(): ProjectCreateBody { + return ProjectCreateBody( + name, + taskType, + description, + gitRepo, + slackChannelId, + slackChannelName, + slackChannelNotificationsEnabled, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = ProjectCreateBody.Builder::class) + @NoAutoDetect + class ProjectCreateBody + internal constructor( + private val name: String?, + private val taskType: TaskType?, + private val description: String?, + private val gitRepo: GitRepo?, + private val slackChannelId: String?, + private val slackChannelName: String?, + private val slackChannelNotificationsEnabled: Boolean?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The project name. */ + @JsonProperty("name") fun name(): String? = name + + /** The task type of the project. */ + @JsonProperty("taskType") fun taskType(): TaskType? = taskType + + /** The project description. */ + @JsonProperty("description") fun description(): String? = description + + @JsonProperty("gitRepo") fun gitRepo(): GitRepo? = gitRepo + + /** The slack channel id connected to the project. */ + @JsonProperty("slackChannelId") fun slackChannelId(): String? = slackChannelId + + /** The slack channel connected to the project. */ + @JsonProperty("slackChannelName") fun slackChannelName(): String? = slackChannelName + + /** Whether slack channel notifications are enabled for the project. */ + @JsonProperty("slackChannelNotificationsEnabled") + fun slackChannelNotificationsEnabled(): Boolean? = slackChannelNotificationsEnabled + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCreateBody && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.gitRepo == other.gitRepo && + this.slackChannelId == other.slackChannelId && + this.slackChannelName == other.slackChannelName && + this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + taskType, + description, + gitRepo, + slackChannelId, + slackChannelName, + slackChannelNotificationsEnabled, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, slackChannelId=$slackChannelId, slackChannelName=$slackChannelName, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var taskType: TaskType? = null + private var description: String? = null + private var gitRepo: GitRepo? = null + private var slackChannelId: String? = null + private var slackChannelName: String? = null + private var slackChannelNotificationsEnabled: Boolean? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCreateBody: ProjectCreateBody) = apply { + this.name = projectCreateBody.name + this.taskType = projectCreateBody.taskType + this.description = projectCreateBody.description + this.gitRepo = projectCreateBody.gitRepo + this.slackChannelId = projectCreateBody.slackChannelId + this.slackChannelName = projectCreateBody.slackChannelName + this.slackChannelNotificationsEnabled = + projectCreateBody.slackChannelNotificationsEnabled + additionalProperties(projectCreateBody.additionalProperties) + } + + /** The project name. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The task type of the project. */ + @JsonProperty("taskType") + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + + /** The project description. */ + @JsonProperty("description") + fun description(description: String) = apply { this.description = description } + + @JsonProperty("gitRepo") + fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } + + /** The slack channel id connected to the project. */ + @JsonProperty("slackChannelId") + fun slackChannelId(slackChannelId: String) = apply { + this.slackChannelId = slackChannelId + } + + /** The slack channel connected to the project. */ + @JsonProperty("slackChannelName") + fun slackChannelName(slackChannelName: String) = apply { + this.slackChannelName = slackChannelName + } + + /** Whether slack channel notifications are enabled for the project. */ + @JsonProperty("slackChannelNotificationsEnabled") + fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = + apply { + this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled + } + + 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(): ProjectCreateBody = + ProjectCreateBody( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(taskType) { "`taskType` is required but was not set" }, + description, + gitRepo, + slackChannelId, + slackChannelName, + slackChannelNotificationsEnabled, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCreateParams && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.gitRepo == other.gitRepo && + this.slackChannelId == other.slackChannelId && + this.slackChannelName == other.slackChannelName && + this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + name, + taskType, + description, + gitRepo, + slackChannelId, + slackChannelName, + slackChannelNotificationsEnabled, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, slackChannelId=$slackChannelId, slackChannelName=$slackChannelName, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var name: String? = null + private var taskType: TaskType? = null + private var description: String? = null + private var gitRepo: GitRepo? = null + private var slackChannelId: String? = null + private var slackChannelName: String? = null + private var slackChannelNotificationsEnabled: Boolean? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCreateParams: ProjectCreateParams) = apply { + this.name = projectCreateParams.name + this.taskType = projectCreateParams.taskType + this.description = projectCreateParams.description + this.gitRepo = projectCreateParams.gitRepo + this.slackChannelId = projectCreateParams.slackChannelId + this.slackChannelName = projectCreateParams.slackChannelName + this.slackChannelNotificationsEnabled = + projectCreateParams.slackChannelNotificationsEnabled + additionalQueryParams(projectCreateParams.additionalQueryParams) + additionalHeaders(projectCreateParams.additionalHeaders) + additionalBodyProperties(projectCreateParams.additionalBodyProperties) + } + + /** The project name. */ + fun name(name: String) = apply { this.name = name } + + /** The task type of the project. */ + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + + /** The project description. */ + fun description(description: String) = apply { this.description = description } + + fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } + + /** The slack channel id connected to the project. */ + fun slackChannelId(slackChannelId: String) = apply { this.slackChannelId = slackChannelId } + + /** The slack channel connected to the project. */ + fun slackChannelName(slackChannelName: String) = apply { + this.slackChannelName = slackChannelName + } + + /** Whether slack channel notifications are enabled for the project. */ + fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = apply { + this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectCreateParams = + ProjectCreateParams( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(taskType) { "`taskType` is required but was not set" }, + description, + gitRepo, + slackChannelId, + slackChannelName, + slackChannelNotificationsEnabled, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + /** Links to the project. */ + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("app") fun app(): String? = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + @JsonProperty("app") fun app(app: String) = apply { this.app = app } + + 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(): Links = + Links( + checkNotNull(app) { "`app` is required but was not set" }, + additionalProperties.toUnmodifiable() + ) + } + } + + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Source && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WEB = Source(JsonField.of("web")) + + @JvmField val API = Source(JsonField.of("api")) + + @JvmField val NULL = Source(JsonField.of("null")) + + @JvmStatic fun of(value: String) = Source(JsonField.of(value)) + } + + enum class Known { + WEB, + API, + NULL, + } + + enum class Value { + WEB, + API, + NULL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TaskType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val LLM_BASE = TaskType(JsonField.of("llm-base")) + + @JvmField val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) + + @JvmField val TABULAR_REGRESSION = TaskType(JsonField.of("tabular-regression")) + + @JvmField val TEXT_CLASSIFICATION = TaskType(JsonField.of("text-classification")) + + @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) + } + + enum class Known { + LLM_BASE, + TABULAR_CLASSIFICATION, + TABULAR_REGRESSION, + TEXT_CLASSIFICATION, + } + + enum class Value { + LLM_BASE, + TABULAR_CLASSIFICATION, + TABULAR_REGRESSION, + TEXT_CLASSIFICATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = GitRepo.Builder::class) + @NoAutoDetect + class GitRepo + 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, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("id") fun id(): String? = id + + @JsonProperty("gitId") fun gitId(): Long? = gitId + + @JsonProperty("dateConnected") fun dateConnected(): OffsetDateTime? = dateConnected + + @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + + @JsonProperty("branch") fun branch(): String? = branch + + @JsonProperty("name") fun name(): String? = name + + @JsonProperty("private") fun private_(): Boolean? = private_ + + @JsonProperty("slug") fun slug(): String? = slug + + @JsonProperty("url") fun url(): String? = url + + @JsonProperty("rootDir") fun rootDir(): String? = rootDir + + @JsonProperty("projectId") fun projectId(): String? = projectId + + @JsonProperty("gitAccountId") fun gitAccountId(): String? = gitAccountId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 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 { + this.dateConnected = dateConnected + } + + @JsonProperty("dateUpdated") + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } + + @JsonProperty("branch") fun branch(branch: String) = apply { this.branch = branch } + + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + @JsonProperty("private") + fun private_(private_: Boolean) = apply { this.private_ = private_ } + + @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } + + @JsonProperty("url") fun url(url: String) = apply { this.url = url } + + @JsonProperty("rootDir") fun rootDir(rootDir: String) = apply { this.rootDir = rootDir } + + @JsonProperty("projectId") + fun projectId(projectId: String) = apply { this.projectId = projectId } + + @JsonProperty("gitAccountId") + fun gitAccountId(gitAccountId: String) = apply { this.gitAccountId = gitAccountId } + + 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(): 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" }, + 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.toUnmodifiable(), + ) + } + } +} 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 new file mode 100644 index 0000000..fdbee3e --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -0,0 +1,1092 @@ +// 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.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.toUnmodifiable +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 +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 sample: 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 unreadNotificationCount: JsonField, + private val links: JsonField, + private val slackChannelNotificationsEnabled: JsonField, + private val slackChannelName: JsonField, + private val slackChannelId: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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")) + + /** Whether the project is a sample project or a user-created project. */ + fun sample(): Boolean = sample.getRequired("sample") + + /** 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 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 number of unread notifications in the project. */ + fun unreadNotificationCount(): Optional = + Optional.ofNullable(unreadNotificationCount.getNullable("unreadNotificationCount")) + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** Whether slack channel notifications are enabled for the project. */ + fun slackChannelNotificationsEnabled(): Optional = + Optional.ofNullable( + slackChannelNotificationsEnabled.getNullable("slackChannelNotificationsEnabled") + ) + + /** The slack channel connected to the project. */ + fun slackChannelName(): Optional = + Optional.ofNullable(slackChannelName.getNullable("slackChannelName")) + + /** The slack channel id connected to the project. */ + fun slackChannelId(): Optional = + Optional.ofNullable(slackChannelId.getNullable("slackChannelId")) + + 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 + + /** The project creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The project creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The project last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The project description. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description + + /** Whether the project is a sample project or a user-created project. */ + @JsonProperty("sample") @ExcludeMissing fun _sample() = sample + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source() = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + + /** 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 + + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount() = developmentGoalCount + + /** The number of tests in the monitoring mode of the project. */ + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + fun _monitoringGoalCount() = monitoringGoalCount + + /** The number of unread notifications in the project. */ + @JsonProperty("unreadNotificationCount") + @ExcludeMissing + fun _unreadNotificationCount() = unreadNotificationCount + + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links() = links + + /** Whether slack channel notifications are enabled for the project. */ + @JsonProperty("slackChannelNotificationsEnabled") + @ExcludeMissing + fun _slackChannelNotificationsEnabled() = slackChannelNotificationsEnabled + + /** The slack channel connected to the project. */ + @JsonProperty("slackChannelName") @ExcludeMissing fun _slackChannelName() = slackChannelName + + /** The slack channel id connected to the project. */ + @JsonProperty("slackChannelId") @ExcludeMissing fun _slackChannelId() = slackChannelId + + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectCreateResponse = apply { + if (!validated) { + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + sample() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + unreadNotificationCount() + links().validate() + slackChannelNotificationsEnabled() + slackChannelName() + slackChannelId() + gitRepo().map { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCreateResponse && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.sample == other.sample && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.unreadNotificationCount == other.unreadNotificationCount && + this.links == other.links && + this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && + this.slackChannelName == other.slackChannelName && + this.slackChannelId == other.slackChannelId && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + sample, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + unreadNotificationCount, + links, + slackChannelNotificationsEnabled, + slackChannelName, + slackChannelId, + gitRepo, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectCreateResponse{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, sample=$sample, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, unreadNotificationCount=$unreadNotificationCount, links=$links, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, slackChannelName=$slackChannelName, slackChannelId=$slackChannelId, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 description: JsonField = JsonMissing.of() + private var sample: 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 unreadNotificationCount: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() + private var slackChannelNotificationsEnabled: JsonField = JsonMissing.of() + private var slackChannelName: JsonField = JsonMissing.of() + private var slackChannelId: 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.sample = projectCreateResponse.sample + 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.unreadNotificationCount = projectCreateResponse.unreadNotificationCount + this.links = projectCreateResponse.links + this.slackChannelNotificationsEnabled = + projectCreateResponse.slackChannelNotificationsEnabled + this.slackChannelName = projectCreateResponse.slackChannelName + this.slackChannelId = projectCreateResponse.slackChannelId + this.gitRepo = projectCreateResponse.gitRepo + additionalProperties(projectCreateResponse.additionalProperties) + } + + /** 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.of(creatorId)) + + /** 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 + } + + /** 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 } + + /** Whether the project is a sample project or a user-created project. */ + fun sample(sample: Boolean) = sample(JsonField.of(sample)) + + /** Whether the project is a sample project or a user-created project. */ + @JsonProperty("sample") + @ExcludeMissing + fun sample(sample: JsonField) = apply { this.sample = sample } + + /** 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 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 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. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** 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 + } + + /** The number of unread notifications in the project. */ + fun unreadNotificationCount(unreadNotificationCount: Long) = + unreadNotificationCount(JsonField.of(unreadNotificationCount)) + + /** The number of unread notifications in the project. */ + @JsonProperty("unreadNotificationCount") + @ExcludeMissing + fun unreadNotificationCount(unreadNotificationCount: JsonField) = apply { + this.unreadNotificationCount = unreadNotificationCount + } + + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + @JsonProperty("links") + @ExcludeMissing + fun links(links: JsonField) = apply { this.links = links } + + /** Whether slack channel notifications are enabled for the project. */ + fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = + slackChannelNotificationsEnabled(JsonField.of(slackChannelNotificationsEnabled)) + + /** Whether slack channel notifications are enabled for the project. */ + @JsonProperty("slackChannelNotificationsEnabled") + @ExcludeMissing + fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: JsonField) = + apply { + this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled + } + + /** The slack channel connected to the project. */ + fun slackChannelName(slackChannelName: String) = + slackChannelName(JsonField.of(slackChannelName)) + + /** The slack channel connected to the project. */ + @JsonProperty("slackChannelName") + @ExcludeMissing + fun slackChannelName(slackChannelName: JsonField) = apply { + this.slackChannelName = slackChannelName + } + + /** The slack channel id connected to the project. */ + fun slackChannelId(slackChannelId: String) = slackChannelId(JsonField.of(slackChannelId)) + + /** The slack channel id connected to the project. */ + @JsonProperty("slackChannelId") + @ExcludeMissing + fun slackChannelId(slackChannelId: JsonField) = apply { + this.slackChannelId = slackChannelId + } + + fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + + @JsonProperty("gitRepo") + @ExcludeMissing + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } + + 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(): ProjectCreateResponse = + ProjectCreateResponse( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + sample, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + unreadNotificationCount, + links, + slackChannelNotificationsEnabled, + slackChannelName, + slackChannelId, + gitRepo, + additionalProperties.toUnmodifiable(), + ) + } + + /** Links to the project. */ + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Source && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WEB = Source(JsonField.of("web")) + + @JvmField val API = Source(JsonField.of("api")) + + @JvmField val NULL = Source(JsonField.of("null")) + + @JvmStatic fun of(value: String) = Source(JsonField.of(value)) + } + + enum class Known { + WEB, + API, + NULL, + } + + enum class Value { + WEB, + API, + NULL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TaskType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val LLM_BASE = TaskType(JsonField.of("llm-base")) + + @JvmField val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) + + @JvmField val TABULAR_REGRESSION = TaskType(JsonField.of("tabular-regression")) + + @JvmField val TEXT_CLASSIFICATION = TaskType(JsonField.of("text-classification")) + + @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) + } + + enum class Known { + LLM_BASE, + TABULAR_CLASSIFICATION, + TABULAR_REGRESSION, + TEXT_CLASSIFICATION, + } + + enum class Value { + LLM_BASE, + TABULAR_CLASSIFICATION, + TABULAR_REGRESSION, + TEXT_CLASSIFICATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = GitRepo.Builder::class) + @NoAutoDetect + class GitRepo + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + 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 name(): String = name.getRequired("name") + + fun private_(): Boolean = private_.getRequired("private") + + 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 gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + + @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + + @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + + @JsonProperty("url") @ExcludeMissing fun _url() = url + + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): GitRepo = apply { + if (!validated) { + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 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) + } + + 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)) + + @JsonProperty("branch") + @ExcludeMissing + fun branch(branch: JsonField) = apply { this.branch = branch } + + 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 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)) + + @JsonProperty("projectId") + @ExcludeMissing + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + + @JsonProperty("gitAccountId") + @ExcludeMissing + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + 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(): GitRepo = + GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties.toUnmodifiable(), + ) + } + } +} 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 new file mode 100644 index 0000000..a6465b1 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -0,0 +1,573 @@ +// 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.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.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class ProjectInferencePipelineCreateParams +constructor( + private val id: String, + private val description: String?, + private val name: String, + private val referenceDatasetUri: String?, + private val storageType: StorageType?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun id(): String = id + + fun description(): Optional = Optional.ofNullable(description) + + fun name(): String = name + + fun referenceDatasetUri(): Optional = Optional.ofNullable(referenceDatasetUri) + + fun storageType(): Optional = Optional.ofNullable(storageType) + + @JvmSynthetic + internal fun getBody(): ProjectInferencePipelineCreateBody { + return ProjectInferencePipelineCreateBody( + description, + name, + referenceDatasetUri, + storageType, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> id + else -> "" + } + } + + @JsonDeserialize(builder = ProjectInferencePipelineCreateBody.Builder::class) + @NoAutoDetect + class ProjectInferencePipelineCreateBody + internal constructor( + private val description: String?, + private val name: String?, + private val referenceDatasetUri: String?, + private val storageType: StorageType?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The inference pipeline description. */ + @JsonProperty("description") fun description(): String? = description + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(): String? = name + + /** The reference dataset URI. */ + @JsonProperty("referenceDatasetUri") + fun referenceDatasetUri(): String? = referenceDatasetUri + + /** The storage type. */ + @JsonProperty("storageType") fun storageType(): StorageType? = storageType + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateBody && + this.description == other.description && + this.name == other.name && + this.referenceDatasetUri == other.referenceDatasetUri && + this.storageType == other.storageType && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + description, + name, + referenceDatasetUri, + storageType, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, storageType=$storageType, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var description: String? = null + private var name: String? = null + private var referenceDatasetUri: String? = null + private var storageType: StorageType? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody + ) = apply { + this.description = projectInferencePipelineCreateBody.description + this.name = projectInferencePipelineCreateBody.name + this.referenceDatasetUri = projectInferencePipelineCreateBody.referenceDatasetUri + this.storageType = projectInferencePipelineCreateBody.storageType + additionalProperties(projectInferencePipelineCreateBody.additionalProperties) + } + + /** The inference pipeline description. */ + @JsonProperty("description") + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The reference dataset URI. */ + @JsonProperty("referenceDatasetUri") + fun referenceDatasetUri(referenceDatasetUri: String) = apply { + this.referenceDatasetUri = referenceDatasetUri + } + + /** The storage type. */ + @JsonProperty("storageType") + fun storageType(storageType: StorageType) = apply { this.storageType = storageType } + + 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(): ProjectInferencePipelineCreateBody = + ProjectInferencePipelineCreateBody( + description, + checkNotNull(name) { "`name` is required but was not set" }, + referenceDatasetUri, + storageType, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateParams && + this.id == other.id && + this.description == other.description && + this.name == other.name && + this.referenceDatasetUri == other.referenceDatasetUri && + this.storageType == other.storageType && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + id, + description, + name, + referenceDatasetUri, + storageType, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectInferencePipelineCreateParams{id=$id, description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, storageType=$storageType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var id: String? = null + private var description: String? = null + private var name: String? = null + private var referenceDatasetUri: String? = null + private var storageType: StorageType? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams + ) = apply { + this.id = projectInferencePipelineCreateParams.id + this.description = projectInferencePipelineCreateParams.description + this.name = projectInferencePipelineCreateParams.name + this.referenceDatasetUri = projectInferencePipelineCreateParams.referenceDatasetUri + this.storageType = projectInferencePipelineCreateParams.storageType + additionalQueryParams(projectInferencePipelineCreateParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineCreateParams.additionalHeaders) + additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) + } + + fun id(id: String) = apply { this.id = id } + + /** The inference pipeline description. */ + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + fun name(name: String) = apply { this.name = name } + + /** The reference dataset URI. */ + fun referenceDatasetUri(referenceDatasetUri: String) = apply { + this.referenceDatasetUri = referenceDatasetUri + } + + /** The storage type. */ + fun storageType(storageType: StorageType) = apply { this.storageType = storageType } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectInferencePipelineCreateParams = + ProjectInferencePipelineCreateParams( + checkNotNull(id) { "`id` is required but was not set" }, + description, + checkNotNull(name) { "`name` is required but was not set" }, + referenceDatasetUri, + storageType, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("app") fun app(): String? = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + @JsonProperty("app") fun app(app: String) = apply { this.app = app } + + 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(): Links = + Links( + checkNotNull(app) { "`app` is required but was not set" }, + additionalProperties.toUnmodifiable() + ) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class StorageType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StorageType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val LOCAL = StorageType(JsonField.of("local")) + + @JvmField val S3 = StorageType(JsonField.of("s3")) + + @JvmField val GCS = StorageType(JsonField.of("gcs")) + + @JvmField val AZURE = StorageType(JsonField.of("azure")) + + @JvmStatic fun of(value: String) = StorageType(JsonField.of(value)) + } + + enum class Known { + LOCAL, + S3, + GCS, + AZURE, + } + + enum class Value { + LOCAL, + S3, + GCS, + AZURE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + LOCAL -> Value.LOCAL + S3 -> Value.S3 + GCS -> Value.GCS + AZURE -> Value.AZURE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LOCAL -> Known.LOCAL + S3 -> Known.S3 + GCS -> Known.GCS + AZURE -> Known.AZURE + else -> throw OpenlayerInvalidDataException("Unknown StorageType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..02a9a38 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -0,0 +1,733 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = ProjectInferencePipelineCreateResponse.Builder::class) +@NoAutoDetect +class ProjectInferencePipelineCreateResponse +private constructor( + private val id: JsonField, + private val projectId: 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 referenceDatasetUri: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val storageType: JsonField, + private val links: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** 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 data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** 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 next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** 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 reference dataset URI. */ + fun referenceDatasetUri(): Optional = + Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) + + /** 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 storage type. */ + fun storageType(): Optional = + Optional.ofNullable(storageType.getNullable("storageType")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** 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") + @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 + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The reference dataset URI. */ + @JsonProperty("referenceDatasetUri") + @ExcludeMissing + fun _referenceDatasetUri() = referenceDatasetUri + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + /** The storage type. */ + @JsonProperty("storageType") @ExcludeMissing fun _storageType() = storageType + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectInferencePipelineCreateResponse = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + referenceDatasetUri() + status() + statusMessage() + storageType() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.referenceDatasetUri == other.referenceDatasetUri && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.storageType == other.storageType && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + referenceDatasetUri, + status, + statusMessage, + storageType, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, referenceDatasetUri=$referenceDatasetUri, status=$status, statusMessage=$statusMessage, storageType=$storageType, links=$links, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: 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 referenceDatasetUri: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var storageType: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse + ) = apply { + this.id = projectInferencePipelineCreateResponse.id + this.projectId = projectInferencePipelineCreateResponse.projectId + 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.referenceDatasetUri = projectInferencePipelineCreateResponse.referenceDatasetUri + this.status = projectInferencePipelineCreateResponse.status + this.statusMessage = projectInferencePipelineCreateResponse.statusMessage + this.storageType = projectInferencePipelineCreateResponse.storageType + this.links = projectInferencePipelineCreateResponse.links + additionalProperties(projectInferencePipelineCreateResponse.additionalProperties) + } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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.of(description)) + + /** 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 last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** 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 total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** The reference dataset URI. */ + fun referenceDatasetUri(referenceDatasetUri: String) = + referenceDatasetUri(JsonField.of(referenceDatasetUri)) + + /** The reference dataset URI. */ + @JsonProperty("referenceDatasetUri") + @ExcludeMissing + fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { + this.referenceDatasetUri = referenceDatasetUri + } + + /** 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)) + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + /** The storage type. */ + fun storageType(storageType: StorageType) = storageType(JsonField.of(storageType)) + + /** The storage type. */ + @JsonProperty("storageType") + @ExcludeMissing + fun storageType(storageType: JsonField) = apply { + this.storageType = storageType + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): ProjectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + referenceDatasetUri, + status, + statusMessage, + storageType, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class StorageType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StorageType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val LOCAL = StorageType(JsonField.of("local")) + + @JvmField val S3 = StorageType(JsonField.of("s3")) + + @JvmField val GCS = StorageType(JsonField.of("gcs")) + + @JvmField val AZURE = StorageType(JsonField.of("azure")) + + @JvmStatic fun of(value: String) = StorageType(JsonField.of(value)) + } + + enum class Known { + LOCAL, + S3, + GCS, + AZURE, + } + + enum class Value { + LOCAL, + S3, + GCS, + AZURE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + LOCAL -> Value.LOCAL + S3 -> Value.S3 + GCS -> Value.GCS + AZURE -> Value.AZURE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LOCAL -> Known.LOCAL + S3 -> Known.S3 + GCS -> Known.GCS + AZURE -> Known.AZURE + else -> throw OpenlayerInvalidDataException("Unknown StorageType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt similarity index 97% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectInferencePipelineListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index 3b5c238..a7d94dc 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.models.* class ProjectInferencePipelineListParams constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectInferencePipelineListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 7663bb5..2d678f9 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -1,23 +1,23 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -import org.openlayer.core.Enum -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = ProjectInferencePipelineListResponse.Builder::class) @NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt similarity index 96% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index ce56d43..b493cd2 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -import org.openlayer.core.Enum -import org.openlayer.core.JsonField -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException -import org.openlayer.models.* class ProjectListParams constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index 7b1bac6..025b285 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -1,23 +1,23 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -import org.openlayer.core.Enum -import org.openlayer.core.ExcludeMissing -import org.openlayer.core.JsonField -import org.openlayer.core.JsonMissing -import org.openlayer.core.JsonValue -import org.openlayer.core.NoAutoDetect -import org.openlayer.core.toUnmodifiable -import org.openlayer.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = ProjectListResponse.Builder::class) @NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/Handlers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt similarity index 84% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/Handlers.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt index 7f8fa7c..357020c 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/Handlers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt @@ -1,24 +1,24 @@ @file:JvmName("Handlers") -package org.openlayer.services +package com.openlayer.api.services import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.http.BinaryResponseContent +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.OpenlayerException +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.InputStream import java.io.OutputStream -import org.openlayer.core.http.BinaryResponseContent -import org.openlayer.core.http.HttpResponse -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.BadRequestException -import org.openlayer.errors.InternalServerException -import org.openlayer.errors.NotFoundException -import org.openlayer.errors.OpenlayerError -import org.openlayer.errors.OpenlayerException -import org.openlayer.errors.PermissionDeniedException -import org.openlayer.errors.RateLimitException -import org.openlayer.errors.UnauthorizedException -import org.openlayer.errors.UnexpectedStatusCodeException -import org.openlayer.errors.UnprocessableEntityException @JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandler diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/HttpRequestBodies.kt similarity index 93% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/HttpRequestBodies.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/HttpRequestBodies.kt index 598a559..3e8a1c1 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/HttpRequestBodies.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/HttpRequestBodies.kt @@ -1,16 +1,16 @@ @file:JvmName("HttpRequestBodies") -package org.openlayer.services +package com.openlayer.api.services import com.fasterxml.jackson.databind.json.JsonMapper +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +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 -import org.openlayer.core.Enum -import org.openlayer.core.JsonValue -import org.openlayer.core.MultipartFormValue -import org.openlayer.core.http.HttpRequestBody -import org.openlayer.errors.OpenlayerException @JvmSynthetic internal inline fun json( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt similarity index 67% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/CommitServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt index 10a5d88..92fd5e9 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt @@ -2,9 +2,9 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.async +package com.openlayer.api.services.async -import org.openlayer.services.async.commits.TestResultServiceAsync +import com.openlayer.api.services.async.commits.TestResultServiceAsync interface CommitServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt similarity index 54% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/CommitServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index 567dd1a..ef73e6d 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.async +package com.openlayer.api.services.async -import org.openlayer.core.ClientOptions -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.services.async.commits.TestResultServiceAsync -import org.openlayer.services.async.commits.TestResultServiceAsyncImpl -import org.openlayer.services.errorHandler +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.async.commits.TestResultServiceAsync +import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl +import com.openlayer.api.services.errorHandler class CommitServiceAsyncImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt similarity index 57% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/InferencePipelineServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt index 12b92b1..dd1d4d5 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt @@ -2,10 +2,10 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.async +package com.openlayer.api.services.async -import org.openlayer.services.async.inferencePipelines.DataServiceAsync -import org.openlayer.services.async.inferencePipelines.TestResultServiceAsync +import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync +import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync interface InferencePipelineServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt similarity index 52% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/InferencePipelineServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 57e7721..f2e5c2f 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -1,15 +1,15 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.async - -import org.openlayer.core.ClientOptions -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.services.async.inferencePipelines.DataServiceAsync -import org.openlayer.services.async.inferencePipelines.DataServiceAsyncImpl -import org.openlayer.services.async.inferencePipelines.TestResultServiceAsync -import org.openlayer.services.async.inferencePipelines.TestResultServiceAsyncImpl -import org.openlayer.services.errorHandler +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync +import com.openlayer.api.services.async.inferencePipelines.DataServiceAsyncImpl +import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync +import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsyncImpl +import com.openlayer.api.services.errorHandler class InferencePipelineServiceAsyncImpl constructor( 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 new file mode 100644 index 0000000..936ec7e --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt @@ -0,0 +1,35 @@ +// 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.ProjectCreateParams +import com.openlayer.api.models.ProjectCreateResponse +import com.openlayer.api.models.ProjectListParams +import com.openlayer.api.models.ProjectListResponse +import com.openlayer.api.services.async.projects.CommitServiceAsync +import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync +import java.util.concurrent.CompletableFuture + +interface ProjectServiceAsync { + + fun commits(): CommitServiceAsync + + fun inferencePipelines(): InferencePipelineServiceAsync + + /** Create a project under the current workspace. */ + @JvmOverloads + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** List the projects in a user's workspace. */ + @JvmOverloads + fun list( + params: ProjectListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): 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 new file mode 100644 index 0000000..bc3ebdc --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.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.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.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class ProjectServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : ProjectServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } + + private val inferencePipelines: InferencePipelineServiceAsync by lazy { + InferencePipelineServiceAsyncImpl(clientOptions) + } + + override fun commits(): CommitServiceAsync = commits + + override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Create a project under the current workspace. */ + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** List the projects in a user's workspace. */ + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/commits/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt similarity index 69% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/commits/TestResultServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt index f4f1596..cbf79aa 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/commits/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt @@ -2,12 +2,12 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.async.commits +package com.openlayer.api.services.async.commits +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions -import org.openlayer.models.CommitTestResultListParams -import org.openlayer.models.CommitTestResultListResponse interface TestResultServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt similarity index 72% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/commits/TestResultServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index a4fd2b0..7429781 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.async.commits +package com.openlayer.api.services.async.commits +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.CommitTestResultListParams -import org.openlayer.models.CommitTestResultListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler class TestResultServiceAsyncImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/DataServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt similarity index 68% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/DataServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt index d38c9de..f7fb4cd 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/DataServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt @@ -2,12 +2,12 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencePipelines +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions -import org.openlayer.models.InferencePipelineDataStreamParams -import org.openlayer.models.InferencePipelineDataStreamResponse interface DataServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt similarity index 71% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/DataServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt index 0a525dd..4a155d3 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencePipelines +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.InferencePipelineDataStreamParams -import org.openlayer.models.InferencePipelineDataStreamResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.json -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler class DataServiceAsyncImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt similarity index 67% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/TestResultServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt index 6bc53cc..3ef1da7 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt @@ -2,12 +2,12 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencePipelines +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions -import org.openlayer.models.InferencePipelineTestResultListParams -import org.openlayer.models.InferencePipelineTestResultListResponse interface TestResultServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt similarity index 71% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt index 1bc0866..568e64f 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencePipelines +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.InferencePipelineTestResultListParams -import org.openlayer.models.InferencePipelineTestResultListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler class TestResultServiceAsyncImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt similarity index 69% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/CommitServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt index 1875026..ee9833d 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt @@ -2,12 +2,12 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.async.projects +package com.openlayer.api.services.async.projects +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions -import org.openlayer.models.ProjectCommitListParams -import org.openlayer.models.ProjectCommitListResponse interface CommitServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt similarity index 72% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/CommitServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index f9f3d2f..41174a6 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.async.projects +package com.openlayer.api.services.async.projects +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.ProjectCommitListParams -import org.openlayer.models.ProjectCommitListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler class CommitServiceAsyncImpl constructor( 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 new file mode 100644 index 0000000..9f53829 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt @@ -0,0 +1,29 @@ +// 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.openlayer.api.core.RequestOptions +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 java.util.concurrent.CompletableFuture + +interface InferencePipelineServiceAsync { + + /** Create an inference pipeline under a project. */ + @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** List the inference pipelines in a project. */ + @JvmOverloads + 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 new file mode 100644 index 0000000..7c01cde --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -0,0 +1,88 @@ +// 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.RequestOptions +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.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.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class InferencePipelineServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Create an inference pipeline under a project. */ + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt similarity index 65% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/CommitService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt index 8aa2c72..86553e1 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt @@ -2,9 +2,9 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.blocking +package com.openlayer.api.services.blocking -import org.openlayer.services.blocking.commits.TestResultService +import com.openlayer.api.services.blocking.commits.TestResultService interface CommitService { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt similarity index 52% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/CommitServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index cf56a53..cae0abd 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking +package com.openlayer.api.services.blocking -import org.openlayer.core.ClientOptions -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.services.blocking.commits.TestResultService -import org.openlayer.services.blocking.commits.TestResultServiceImpl -import org.openlayer.services.errorHandler +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.blocking.commits.TestResultService +import com.openlayer.api.services.blocking.commits.TestResultServiceImpl +import com.openlayer.api.services.errorHandler class CommitServiceImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt similarity index 56% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/InferencePipelineService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt index 5d9bf22..161248f 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt @@ -2,10 +2,10 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.blocking +package com.openlayer.api.services.blocking -import org.openlayer.services.blocking.inferencePipelines.DataService -import org.openlayer.services.blocking.inferencePipelines.TestResultService +import com.openlayer.api.services.blocking.inferencePipelines.DataService +import com.openlayer.api.services.blocking.inferencePipelines.TestResultService interface InferencePipelineService { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt similarity index 50% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/InferencePipelineServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index bfcbe42..e83ed60 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -1,15 +1,15 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking - -import org.openlayer.core.ClientOptions -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.services.blocking.inferencePipelines.DataService -import org.openlayer.services.blocking.inferencePipelines.DataServiceImpl -import org.openlayer.services.blocking.inferencePipelines.TestResultService -import org.openlayer.services.blocking.inferencePipelines.TestResultServiceImpl -import org.openlayer.services.errorHandler +package com.openlayer.api.services.blocking + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.blocking.inferencePipelines.DataService +import com.openlayer.api.services.blocking.inferencePipelines.DataServiceImpl +import com.openlayer.api.services.blocking.inferencePipelines.TestResultService +import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceImpl +import com.openlayer.api.services.errorHandler class InferencePipelineServiceImpl constructor( 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 new file mode 100644 index 0000000..1c34c22 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt @@ -0,0 +1,34 @@ +// 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.ProjectCreateParams +import com.openlayer.api.models.ProjectCreateResponse +import com.openlayer.api.models.ProjectListParams +import com.openlayer.api.models.ProjectListResponse +import com.openlayer.api.services.blocking.projects.CommitService +import com.openlayer.api.services.blocking.projects.InferencePipelineService + +interface ProjectService { + + fun commits(): CommitService + + fun inferencePipelines(): InferencePipelineService + + /** Create a project under the current workspace. */ + @JvmOverloads + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectCreateResponse + + /** List the projects in a user's workspace. */ + @JvmOverloads + fun list( + params: ProjectListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectListResponse +} 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 new file mode 100644 index 0000000..be94238 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -0,0 +1,97 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.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.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.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler + +class ProjectServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : ProjectService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } + + private val inferencePipelines: InferencePipelineService by lazy { + InferencePipelineServiceImpl(clientOptions) + } + + override fun commits(): CommitService = commits + + override fun inferencePipelines(): InferencePipelineService = inferencePipelines + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Create a project under the current workspace. */ + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions + ): ProjectCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** List the projects in a user's workspace. */ + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions + ): ProjectListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/commits/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt similarity index 66% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/commits/TestResultService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt index b9fb6aa..68db234 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/commits/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt @@ -2,11 +2,11 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.blocking.commits +package com.openlayer.api.services.blocking.commits -import org.openlayer.core.RequestOptions -import org.openlayer.models.CommitTestResultListParams -import org.openlayer.models.CommitTestResultListResponse +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse interface TestResultService { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt similarity index 70% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/commits/TestResultServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index 4074e01..0992990 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking.commits +package com.openlayer.api.services.blocking.commits -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.CommitTestResultListParams -import org.openlayer.models.CommitTestResultListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/DataService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt similarity index 64% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/DataService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt index 44ba3d7..ecfe2e5 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/DataService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt @@ -2,11 +2,11 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencePipelines -import org.openlayer.core.RequestOptions -import org.openlayer.models.InferencePipelineDataStreamParams -import org.openlayer.models.InferencePipelineDataStreamResponse +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse interface DataService { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt similarity index 70% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/DataServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt index 06e6b2e..31e69fe 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencePipelines -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.InferencePipelineDataStreamParams -import org.openlayer.models.InferencePipelineDataStreamResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.json -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class DataServiceImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt similarity index 63% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt index 74c6cc0..37774ae 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt @@ -2,11 +2,11 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencePipelines -import org.openlayer.core.RequestOptions -import org.openlayer.models.InferencePipelineTestResultListParams -import org.openlayer.models.InferencePipelineTestResultListResponse +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse interface TestResultService { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt similarity index 70% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt index 7d13d13..edb9021 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencePipelines -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.InferencePipelineTestResultListParams -import org.openlayer.models.InferencePipelineTestResultListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt similarity index 65% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/CommitService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt index 9c143ef..b942ebd 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt @@ -2,11 +2,11 @@ @file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 -package org.openlayer.services.blocking.projects +package com.openlayer.api.services.blocking.projects -import org.openlayer.core.RequestOptions -import org.openlayer.models.ProjectCommitListParams -import org.openlayer.models.ProjectCommitListResponse +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse interface CommitService { diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt similarity index 70% rename from openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/CommitServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index 33558b0..0e91983 100644 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking.projects +package com.openlayer.api.services.blocking.projects -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.ProjectCommitListParams -import org.openlayer.models.ProjectCommitListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class CommitServiceImpl constructor( 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 new file mode 100644 index 0000000..e9fb6bf --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt @@ -0,0 +1,28 @@ +// 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.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.ProjectInferencePipelineListResponse + +interface InferencePipelineService { + + /** Create an inference pipeline under a project. */ + @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectInferencePipelineCreateResponse + + /** List the inference pipelines in a project. */ + @JvmOverloads + fun list( + params: ProjectInferencePipelineListParams, + 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 new file mode 100644 index 0000000..bb3414c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -0,0 +1,85 @@ +// 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.RequestOptions +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.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.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler + +class InferencePipelineServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Create an inference pipeline under a project. */ + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions + ): ProjectInferencePipelineCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsync.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsync.kt deleted file mode 100644 index b3fa807..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsync.kt +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - -package org.openlayer.services.async - -import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions -import org.openlayer.models.ProjectListParams -import org.openlayer.models.ProjectListResponse -import org.openlayer.services.async.projects.CommitServiceAsync -import org.openlayer.services.async.projects.InferencePipelineServiceAsync - -interface ProjectServiceAsync { - - fun commits(): CommitServiceAsync - - fun inferencePipelines(): InferencePipelineServiceAsync - - /** List the projects in a user's workspace. */ - @JvmOverloads - fun list( - params: ProjectListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsyncImpl.kt deleted file mode 100644 index 9cb3d2b..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/ProjectServiceAsyncImpl.kt +++ /dev/null @@ -1,67 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package org.openlayer.services.async - -import java.util.concurrent.CompletableFuture -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.ProjectListParams -import org.openlayer.models.ProjectListResponse -import org.openlayer.services.async.projects.CommitServiceAsync -import org.openlayer.services.async.projects.CommitServiceAsyncImpl -import org.openlayer.services.async.projects.InferencePipelineServiceAsync -import org.openlayer.services.async.projects.InferencePipelineServiceAsyncImpl -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler - -class ProjectServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : ProjectServiceAsync { - - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - - private val inferencePipelines: InferencePipelineServiceAsync by lazy { - InferencePipelineServiceAsyncImpl(clientOptions) - } - - override fun commits(): CommitServiceAsync = commits - - override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** List the projects in a user's workspace. */ - override fun list( - params: ProjectListParams, - requestOptions: RequestOptions - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsync.kt deleted file mode 100644 index 32d2e12..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsync.kt +++ /dev/null @@ -1,20 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - -package org.openlayer.services.async.projects - -import java.util.concurrent.CompletableFuture -import org.openlayer.core.RequestOptions -import org.openlayer.models.ProjectInferencePipelineListParams -import org.openlayer.models.ProjectInferencePipelineListResponse - -interface InferencePipelineServiceAsync { - - /** List the inference pipelines in a project. */ - @JvmOverloads - fun list( - params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsyncImpl.kt deleted file mode 100644 index 9a5fe84..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ /dev/null @@ -1,54 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package org.openlayer.services.async.projects - -import java.util.concurrent.CompletableFuture -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.ProjectInferencePipelineListParams -import org.openlayer.models.ProjectInferencePipelineListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler - -class InferencePipelineServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineServiceAsync { - - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectService.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectService.kt deleted file mode 100644 index da82905..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectService.kt +++ /dev/null @@ -1,25 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - -package org.openlayer.services.blocking - -import org.openlayer.core.RequestOptions -import org.openlayer.models.ProjectListParams -import org.openlayer.models.ProjectListResponse -import org.openlayer.services.blocking.projects.CommitService -import org.openlayer.services.blocking.projects.InferencePipelineService - -interface ProjectService { - - fun commits(): CommitService - - fun inferencePipelines(): InferencePipelineService - - /** List the projects in a user's workspace. */ - @JvmOverloads - fun list( - params: ProjectListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectListResponse -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectServiceImpl.kt deleted file mode 100644 index 234a84e..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/ProjectServiceImpl.kt +++ /dev/null @@ -1,65 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package org.openlayer.services.blocking - -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.ProjectListParams -import org.openlayer.models.ProjectListResponse -import org.openlayer.services.blocking.projects.CommitService -import org.openlayer.services.blocking.projects.CommitServiceImpl -import org.openlayer.services.blocking.projects.InferencePipelineService -import org.openlayer.services.blocking.projects.InferencePipelineServiceImpl -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler - -class ProjectServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : ProjectService { - - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - - private val inferencePipelines: InferencePipelineService by lazy { - InferencePipelineServiceImpl(clientOptions) - } - - override fun commits(): CommitService = commits - - override fun inferencePipelines(): InferencePipelineService = inferencePipelines - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** List the projects in a user's workspace. */ - override fun list( - params: ProjectListParams, - requestOptions: RequestOptions - ): ProjectListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineService.kt deleted file mode 100644 index 2d6c42a..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineService.kt +++ /dev/null @@ -1,19 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - -package org.openlayer.services.blocking.projects - -import org.openlayer.core.RequestOptions -import org.openlayer.models.ProjectInferencePipelineListParams -import org.openlayer.models.ProjectInferencePipelineListResponse - -interface InferencePipelineService { - - /** List the inference pipelines in a project. */ - @JvmOverloads - fun list( - params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectInferencePipelineListResponse -} diff --git a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceImpl.kt deleted file mode 100644 index 0d22af4..0000000 --- a/openlayer-java-core/src/main/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceImpl.kt +++ /dev/null @@ -1,52 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package org.openlayer.services.blocking.projects - -import org.openlayer.core.ClientOptions -import org.openlayer.core.RequestOptions -import org.openlayer.core.http.HttpMethod -import org.openlayer.core.http.HttpRequest -import org.openlayer.core.http.HttpResponse.Handler -import org.openlayer.errors.OpenlayerError -import org.openlayer.models.ProjectInferencePipelineListParams -import org.openlayer.models.ProjectInferencePipelineListResponse -import org.openlayer.services.errorHandler -import org.openlayer.services.jsonHandler -import org.openlayer.services.withErrorHandler - -class InferencePipelineServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineService { - - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } -} diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/TestServerExtension.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt similarity index 98% rename from openlayer-java-core/src/test/kotlin/org/openlayer/TestServerExtension.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt index 01e0651..0d72bda 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/TestServerExtension.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt @@ -1,4 +1,4 @@ -package org.openlayer +package com.openlayer.api import java.lang.RuntimeException import java.net.URL diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/client/OpenlayerClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt similarity index 71% rename from openlayer-java-core/src/test/kotlin/org/openlayer/client/OpenlayerClientTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt index 8259b0a..bf5ebe7 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/client/OpenlayerClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.client +package com.openlayer.api.client class OpenlayerClientTest diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/core/http/HttpRequestTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt similarity index 95% rename from openlayer-java-core/src/test/kotlin/org/openlayer/core/http/HttpRequestTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt index 5ddca6e..fe7fc1c 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/core/http/HttpRequestTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt @@ -1,4 +1,4 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/core/http/RetryingHttpClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt similarity index 98% rename from openlayer-java-core/src/test/kotlin/org/openlayer/core/http/RetryingHttpClientTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt index dc8258b..ce97799 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/core/http/RetryingHttpClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt @@ -1,13 +1,13 @@ -package org.openlayer.core.http +package com.openlayer.api.core.http import com.github.tomakehurst.wiremock.client.WireMock.* 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 org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.openlayer.client.okhttp.OkHttpClient @WireMockTest internal class RetryingHttpClientTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt similarity index 98% rename from openlayer-java-core/src/test/kotlin/org/openlayer/core/http/SerializerTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt index 6b50f24..a2f9465 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/core/http/SerializerTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt @@ -1,13 +1,13 @@ -package org.openlayer.core.http +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 -import org.openlayer.core.* internal class SerializerTest { @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/CommitTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt similarity index 97% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/CommitTestResultListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt index cfdf441..01924b0 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/CommitTestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.models.* class CommitTestResultListParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/CommitTestResultListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt index 9a27418..05c6717 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/CommitTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.core.JsonValue class CommitTestResultListResponseTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineDataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt similarity index 98% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineDataStreamParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt index 466b844..37203d8 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineDataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.core.JsonValue -import org.openlayer.models.* class InferencePipelineDataStreamParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt similarity index 95% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineDataStreamResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt index 5721590..5d5c07f 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineDataStreamResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt similarity index 97% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineTestResultListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt index 7871212..0e1b9ea 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineTestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.models.* class InferencePipelineTestResultListParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineTestResultListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt index e372b2f..d9eadbb 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/InferencePipelineTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.core.JsonValue class InferencePipelineTestResultListResponseTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectCommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt similarity index 95% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectCommitListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt index bb52fa3..83e994e 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectCommitListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.models.* class ProjectCommitListParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectCommitListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt index cd1982f..72defbb 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectCommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat 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 new file mode 100644 index 0000000..5d691bf --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt @@ -0,0 +1,106 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectCreateParamsTest { + + @Test + fun createProjectCreateParams() { + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) + .slackChannelId("C01B2PZQX1Z") + .slackChannelName("#my-project") + .slackChannelNotificationsEnabled(true) + .build() + } + + @Test + fun getBody() { + val params = + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) + .slackChannelId("C01B2PZQX1Z") + .slackChannelName("#my-project") + .slackChannelNotificationsEnabled(true) + .build() + val body = params.getBody() + 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.gitRepo()) + .isEqualTo( + 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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) + assertThat(body.slackChannelId()).isEqualTo("C01B2PZQX1Z") + assertThat(body.slackChannelName()).isEqualTo("#my-project") + assertThat(body.slackChannelNotificationsEnabled()).isEqualTo(true) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + } +} 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/ProjectCreateResponseTest.kt new file mode 100644 index 0000000..3fca2c5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt @@ -0,0 +1,109 @@ +// 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 ProjectCreateResponseTest { + + @Test + fun createProjectCreateResponse() { + 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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .sample(true) + .source(ProjectCreateResponse.Source.WEB) + .taskType(ProjectCreateResponse.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) + .slackChannelId("C01B2PZQX1Z") + .slackChannelName("#my-project") + .slackChannelNotificationsEnabled(true) + .unreadNotificationCount(123L) + .build() + assertThat(projectCreateResponse).isNotNull + assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectCreateResponse.creatorId()) + .contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(projectCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) + assertThat(projectCreateResponse.links()) + .isEqualTo( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.name()).isEqualTo("My Project") + assertThat(projectCreateResponse.sample()).isEqualTo(true) + assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) + assertThat(projectCreateResponse.taskType()) + .isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) + assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) + assertThat(projectCreateResponse.workspaceId()) + .contains("055fddb1-261f-4654-8598-f6347ee46a09") + assertThat(projectCreateResponse.description()).contains("My project description.") + assertThat(projectCreateResponse.gitRepo()) + .contains( + 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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) + assertThat(projectCreateResponse.slackChannelId()).contains("C01B2PZQX1Z") + assertThat(projectCreateResponse.slackChannelName()).contains("#my-project") + assertThat(projectCreateResponse.slackChannelNotificationsEnabled()).contains(true) + assertThat(projectCreateResponse.unreadNotificationCount()).contains(123L) + } +} 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 new file mode 100644 index 0000000..fc267a2 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt @@ -0,0 +1,66 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectInferencePipelineCreateParamsTest { + + @Test + fun createProjectInferencePipelineCreateParams() { + ProjectInferencePipelineCreateParams.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("s3://...") + .storageType(ProjectInferencePipelineCreateParams.StorageType.LOCAL) + .build() + } + + @Test + fun getBody() { + val params = + ProjectInferencePipelineCreateParams.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("s3://...") + .storageType(ProjectInferencePipelineCreateParams.StorageType.LOCAL) + .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("s3://...") + assertThat(body.storageType()) + .isEqualTo(ProjectInferencePipelineCreateParams.StorageType.LOCAL) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + ProjectInferencePipelineCreateParams.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("production") + } + + @Test + fun getPathParam() { + val params = + ProjectInferencePipelineCreateParams.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .build() + assertThat(params).isNotNull + // path param "id" + 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/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt new file mode 100644 index 0000000..506e8ca --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt @@ -0,0 +1,77 @@ +// 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 ProjectInferencePipelineCreateResponseTest { + + @Test + fun createProjectInferencePipelineCreateResponse() { + val projectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse.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(123L) + .links( + ProjectInferencePipelineCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .referenceDatasetUri("s3://...") + .storageType(ProjectInferencePipelineCreateResponse.StorageType.LOCAL) + .build() + assertThat(projectInferencePipelineCreateResponse).isNotNull + assertThat(projectInferencePipelineCreateResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.description()) + .contains("This pipeline is used for production.") + assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.links()) + .isEqualTo( + ProjectInferencePipelineCreateResponse.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(123L) + assertThat(projectInferencePipelineCreateResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.status()) + .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) + assertThat(projectInferencePipelineCreateResponse.statusMessage()) + .contains("Tests successfully evaluated") + assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.referenceDatasetUri()) + .contains("s3://...") + assertThat(projectInferencePipelineCreateResponse.storageType()) + .contains(ProjectInferencePipelineCreateResponse.StorageType.LOCAL) + } +} diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectInferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt similarity index 96% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectInferencePipelineListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt index d4538e1..14617b0 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectInferencePipelineListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.models.* class ProjectInferencePipelineListParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectInferencePipelineListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt index 70d97a9..bb7a9ef 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectInferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt similarity index 95% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt index 0659e48..2daea94 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openlayer.models.* class ProjectListParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt index cf56860..afb6ebb 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/models/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.models +package com.openlayer.api.models import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt similarity index 97% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/ErrorHandlingTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index 6c4e09f..fc8198c 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services +package com.openlayer.api.services import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl @@ -13,28 +13,28 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.google.common.collect.ImmutableListMultimap import com.google.common.collect.ListMultimap +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +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 +import com.openlayer.api.errors.UnauthorizedException +import com.openlayer.api.errors.UnexpectedStatusCodeException +import com.openlayer.api.errors.UnprocessableEntityException +import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.assertj.core.api.InstanceOfAssertFactories import org.assertj.guava.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.openlayer.client.OpenlayerClient -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.core.JsonString -import org.openlayer.core.JsonValue -import org.openlayer.core.jsonMapper -import org.openlayer.errors.BadRequestException -import org.openlayer.errors.InternalServerException -import org.openlayer.errors.NotFoundException -import org.openlayer.errors.OpenlayerError -import org.openlayer.errors.OpenlayerException -import org.openlayer.errors.PermissionDeniedException -import org.openlayer.errors.RateLimitException -import org.openlayer.errors.UnauthorizedException -import org.openlayer.errors.UnexpectedStatusCodeException -import org.openlayer.errors.UnprocessableEntityException -import org.openlayer.models.* @WireMockTest class ErrorHandlingTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/ServiceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt similarity index 93% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/ServiceParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt index a636b68..15b11a5 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/ServiceParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services +package com.openlayer.api.services import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl @@ -15,14 +15,14 @@ import com.github.tomakehurst.wiremock.client.WireMock.stubFor import com.github.tomakehurst.wiremock.client.WireMock.verify import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo 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.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import com.openlayer.api.models.* import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.openlayer.client.OpenlayerClient -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.core.JsonString -import org.openlayer.core.JsonValue -import org.openlayer.core.jsonMapper -import org.openlayer.models.* @WireMockTest class ServiceParamsTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt similarity index 58% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/CommitServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt index 25e1b88..4a62862 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking +package com.openlayer.api.services.blocking +import com.openlayer.api.TestServerExtension +import com.openlayer.api.models.* import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.models.* @ExtendWith(TestServerExtension::class) class CommitServiceTest diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt similarity index 59% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/InferencePipelineServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt index 8f419a4..af33b2f 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking +package com.openlayer.api.services.blocking +import com.openlayer.api.TestServerExtension +import com.openlayer.api.models.* import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.models.* @ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest 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 new file mode 100644 index 0000000..e7e4e02 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt @@ -0,0 +1,74 @@ +// 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.* +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ProjectServiceTest { + + @Test + fun callCreate() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectCreateResponse = + projectService.create( + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) + .slackChannelId("C01B2PZQX1Z") + .slackChannelName("#my-project") + .slackChannelNotificationsEnabled(true) + .build() + ) + println(projectCreateResponse) + projectCreateResponse.validate() + } + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectListResponse = + projectService.list( + ProjectListParams.builder() + .name("string") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + ) + println(projectListResponse) + projectListResponse.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt similarity index 84% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/commits/TestResultServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index c432336..171aa44 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking.commits +package com.openlayer.api.services.blocking.commits +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.models.* @ExtendWith(TestServerExtension::class) class TestResultServiceTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/inferencePipelines/DataServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt similarity index 90% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/inferencePipelines/DataServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt index 69a5a11..d004505 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/inferencePipelines/DataServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.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.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.core.JsonValue -import org.openlayer.models.* @ExtendWith(TestServerExtension::class) class DataServiceTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt similarity index 85% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt index 0434c8e..c100166 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/inferencePipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.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.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.models.* @ExtendWith(TestServerExtension::class) class TestResultServiceTest { diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt similarity index 81% rename from openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/CommitServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 24c188f..de43f45 100644 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package org.openlayer.services.blocking.projects +package com.openlayer.api.services.blocking.projects +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.models.* @ExtendWith(TestServerExtension::class) class CommitServiceTest { 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 new file mode 100644 index 0000000..22e13d5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -0,0 +1,56 @@ +// 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.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceTest { + + @Test + fun callCreate() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineCreateResponse = + inferencePipelineService.create( + ProjectInferencePipelineCreateParams.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("s3://...") + .storageType(ProjectInferencePipelineCreateParams.StorageType.LOCAL) + .build() + ) + println(projectInferencePipelineCreateResponse) + projectInferencePipelineCreateResponse.validate() + } + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineListResponse = + inferencePipelineService.list( + ProjectInferencePipelineListParams.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + ) + println(projectInferencePipelineListResponse) + projectInferencePipelineListResponse.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/ProjectServiceTest.kt b/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/ProjectServiceTest.kt deleted file mode 100644 index cb284db..0000000 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/ProjectServiceTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package org.openlayer.services.blocking - -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.models.* - -@ExtendWith(TestServerExtension::class) -class ProjectServiceTest { - - @Test - fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectListResponse = - projectService.list( - ProjectListParams.builder() - .name("string") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() - ) - println(projectListResponse) - projectListResponse.validate() - } -} diff --git a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceTest.kt deleted file mode 100644 index 9f7399f..0000000 --- a/openlayer-java-core/src/test/kotlin/org/openlayer/services/blocking/projects/InferencePipelineServiceTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package org.openlayer.services.blocking.projects - -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -import org.openlayer.TestServerExtension -import org.openlayer.client.okhttp.OpenlayerOkHttpClient -import org.openlayer.models.* - -@ExtendWith(TestServerExtension::class) -class InferencePipelineServiceTest { - - @Test - fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineListResponse = - inferencePipelineService.list( - ProjectInferencePipelineListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") - .page(123L) - .perPage(100L) - .build() - ) - println(projectInferencePipelineListResponse) - projectInferencePipelineListResponse.validate() - } -} From 8c4398ed39212e1e018729727d7dfbe70a8db27d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:57:16 +0000 Subject: [PATCH 02/21] feat(api): update via SDK Studio (#7) --- .stats.yml | 2 +- .../ProjectInferencePipelineCreateParams.kt | 573 ---------- .../ProjectInferencePipelineCreateResponse.kt | 733 ------------ .../ProjectInferencePipelineListParams.kt | 194 ---- .../ProjectInferencePipelineListResponse.kt | 1017 ----------------- .../projects/InferencePipelineServiceAsync.kt | 24 +- .../InferencePipelineServiceAsyncImpl.kt | 72 -- .../projects/InferencePipelineService.kt | 23 +- .../projects/InferencePipelineServiceImpl.kt | 69 -- ...rojectInferencePipelineCreateParamsTest.kt | 66 -- ...jectInferencePipelineCreateResponseTest.kt | 77 -- .../ProjectInferencePipelineListParamsTest.kt | 59 - ...rojectInferencePipelineListResponseTest.kt | 98 -- .../projects/InferencePipelineServiceTest.kt | 49 +- 14 files changed, 4 insertions(+), 3052 deletions(-) delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 699660e..2b7dbf3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 8 +configured_endpoints: 6 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 deleted file mode 100644 index a6465b1..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ /dev/null @@ -1,573 +0,0 @@ -// 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.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.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional - -class ProjectInferencePipelineCreateParams -constructor( - private val id: String, - private val description: String?, - private val name: String, - private val referenceDatasetUri: String?, - private val storageType: StorageType?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun id(): String = id - - fun description(): Optional = Optional.ofNullable(description) - - fun name(): String = name - - fun referenceDatasetUri(): Optional = Optional.ofNullable(referenceDatasetUri) - - fun storageType(): Optional = Optional.ofNullable(storageType) - - @JvmSynthetic - internal fun getBody(): ProjectInferencePipelineCreateBody { - return ProjectInferencePipelineCreateBody( - description, - name, - referenceDatasetUri, - storageType, - additionalBodyProperties, - ) - } - - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> id - else -> "" - } - } - - @JsonDeserialize(builder = ProjectInferencePipelineCreateBody.Builder::class) - @NoAutoDetect - class ProjectInferencePipelineCreateBody - internal constructor( - private val description: String?, - private val name: String?, - private val referenceDatasetUri: String?, - private val storageType: StorageType?, - private val additionalProperties: Map, - ) { - - private var hashCode: Int = 0 - - /** The inference pipeline description. */ - @JsonProperty("description") fun description(): String? = description - - /** The inference pipeline name. */ - @JsonProperty("name") fun name(): String? = name - - /** The reference dataset URI. */ - @JsonProperty("referenceDatasetUri") - fun referenceDatasetUri(): String? = referenceDatasetUri - - /** The storage type. */ - @JsonProperty("storageType") fun storageType(): StorageType? = storageType - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateBody && - this.description == other.description && - this.name == other.name && - this.referenceDatasetUri == other.referenceDatasetUri && - this.storageType == other.storageType && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - description, - name, - referenceDatasetUri, - storageType, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectInferencePipelineCreateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, storageType=$storageType, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var description: String? = null - private var name: String? = null - private var referenceDatasetUri: String? = null - private var storageType: StorageType? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody - ) = apply { - this.description = projectInferencePipelineCreateBody.description - this.name = projectInferencePipelineCreateBody.name - this.referenceDatasetUri = projectInferencePipelineCreateBody.referenceDatasetUri - this.storageType = projectInferencePipelineCreateBody.storageType - additionalProperties(projectInferencePipelineCreateBody.additionalProperties) - } - - /** The inference pipeline description. */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } - - /** The inference pipeline name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } - - /** The reference dataset URI. */ - @JsonProperty("referenceDatasetUri") - fun referenceDatasetUri(referenceDatasetUri: String) = apply { - this.referenceDatasetUri = referenceDatasetUri - } - - /** The storage type. */ - @JsonProperty("storageType") - fun storageType(storageType: StorageType) = apply { this.storageType = storageType } - - 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(): ProjectInferencePipelineCreateBody = - ProjectInferencePipelineCreateBody( - description, - checkNotNull(name) { "`name` is required but was not set" }, - referenceDatasetUri, - storageType, - additionalProperties.toUnmodifiable(), - ) - } - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateParams && - this.id == other.id && - this.description == other.description && - this.name == other.name && - this.referenceDatasetUri == other.referenceDatasetUri && - this.storageType == other.storageType && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int { - return Objects.hash( - id, - description, - name, - referenceDatasetUri, - storageType, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) - } - - override fun toString() = - "ProjectInferencePipelineCreateParams{id=$id, description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, storageType=$storageType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var id: String? = null - private var description: String? = null - private var name: String? = null - private var referenceDatasetUri: String? = null - private var storageType: StorageType? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams - ) = apply { - this.id = projectInferencePipelineCreateParams.id - this.description = projectInferencePipelineCreateParams.description - this.name = projectInferencePipelineCreateParams.name - this.referenceDatasetUri = projectInferencePipelineCreateParams.referenceDatasetUri - this.storageType = projectInferencePipelineCreateParams.storageType - additionalQueryParams(projectInferencePipelineCreateParams.additionalQueryParams) - additionalHeaders(projectInferencePipelineCreateParams.additionalHeaders) - additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) - } - - fun id(id: String) = apply { this.id = id } - - /** The inference pipeline description. */ - fun description(description: String) = apply { this.description = description } - - /** The inference pipeline name. */ - fun name(name: String) = apply { this.name = name } - - /** The reference dataset URI. */ - fun referenceDatasetUri(referenceDatasetUri: String) = apply { - this.referenceDatasetUri = referenceDatasetUri - } - - /** The storage type. */ - fun storageType(storageType: StorageType) = apply { this.storageType = storageType } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) - } - - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) - } - - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) - } - - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } - - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - this.additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectInferencePipelineCreateParams = - ProjectInferencePipelineCreateParams( - checkNotNull(id) { "`id` is required but was not set" }, - description, - checkNotNull(name) { "`name` is required but was not set" }, - referenceDatasetUri, - storageType, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = Links.Builder::class) - @NoAutoDetect - class Links - private constructor( - private val app: String?, - private val additionalProperties: Map, - ) { - - private var hashCode: Int = 0 - - @JsonProperty("app") fun app(): String? = app - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var app: String? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) - } - - @JsonProperty("app") fun app(app: String) = apply { this.app = app } - - 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(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() - ) - } - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val QUEUED = Status(JsonField.of("queued")) - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PAUSED = Status(JsonField.of("paused")) - - @JvmField val FAILED = Status(JsonField.of("failed")) - - @JvmField val COMPLETED = Status(JsonField.of("completed")) - - @JvmField val UNKNOWN = Status(JsonField.of("unknown")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - } - - enum class Value { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - _UNKNOWN, - } - - 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 - } - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - } - - class StorageType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StorageType && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val LOCAL = StorageType(JsonField.of("local")) - - @JvmField val S3 = StorageType(JsonField.of("s3")) - - @JvmField val GCS = StorageType(JsonField.of("gcs")) - - @JvmField val AZURE = StorageType(JsonField.of("azure")) - - @JvmStatic fun of(value: String) = StorageType(JsonField.of(value)) - } - - enum class Known { - LOCAL, - S3, - GCS, - AZURE, - } - - enum class Value { - LOCAL, - S3, - GCS, - AZURE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - LOCAL -> Value.LOCAL - S3 -> Value.S3 - GCS -> Value.GCS - AZURE -> Value.AZURE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - LOCAL -> Known.LOCAL - S3 -> Known.S3 - GCS -> Known.GCS - AZURE -> Known.AZURE - else -> throw OpenlayerInvalidDataException("Unknown StorageType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } -} 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 deleted file mode 100644 index 02a9a38..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ /dev/null @@ -1,733 +0,0 @@ -// 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.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.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional - -@JsonDeserialize(builder = ProjectInferencePipelineCreateResponse.Builder::class) -@NoAutoDetect -class ProjectInferencePipelineCreateResponse -private constructor( - private val id: JsonField, - private val projectId: 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 referenceDatasetUri: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val storageType: JsonField, - private val links: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The inference pipeline id. */ - fun id(): String = id.getRequired("id") - - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** 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 data sample received date. */ - fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - - /** 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 next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - - /** 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 reference dataset URI. */ - fun referenceDatasetUri(): Optional = - Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) - - /** 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 storage type. */ - fun storageType(): Optional = - Optional.ofNullable(storageType.getNullable("storageType")) - - fun links(): Links = links.getRequired("links") - - /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - - /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** 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") - @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 - - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun _dateOfNextEvaluation() = dateOfNextEvaluation - - /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount - - /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount - - /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount - - /** The reference dataset URI. */ - @JsonProperty("referenceDatasetUri") - @ExcludeMissing - fun _referenceDatasetUri() = referenceDatasetUri - - /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - /** The storage type. */ - @JsonProperty("storageType") @ExcludeMissing fun _storageType() = storageType - - @JsonProperty("links") @ExcludeMissing fun _links() = links - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): ProjectInferencePipelineCreateResponse = apply { - if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - referenceDatasetUri() - status() - statusMessage() - storageType() - links().validate() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateResponse && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.referenceDatasetUri == other.referenceDatasetUri && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.storageType == other.storageType && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - referenceDatasetUri, - status, - statusMessage, - storageType, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, referenceDatasetUri=$referenceDatasetUri, status=$status, statusMessage=$statusMessage, storageType=$storageType, links=$links, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - private var projectId: 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 referenceDatasetUri: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var storageType: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse - ) = apply { - this.id = projectInferencePipelineCreateResponse.id - this.projectId = projectInferencePipelineCreateResponse.projectId - 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.referenceDatasetUri = projectInferencePipelineCreateResponse.referenceDatasetUri - this.status = projectInferencePipelineCreateResponse.status - this.statusMessage = projectInferencePipelineCreateResponse.statusMessage - this.storageType = projectInferencePipelineCreateResponse.storageType - this.links = projectInferencePipelineCreateResponse.links - additionalProperties(projectInferencePipelineCreateResponse.additionalProperties) - } - - /** 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 inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - - /** 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 - } - - /** 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.of(description)) - - /** 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 last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated - } - - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) - - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } - - /** 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 total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } - - /** The reference dataset URI. */ - fun referenceDatasetUri(referenceDatasetUri: String) = - referenceDatasetUri(JsonField.of(referenceDatasetUri)) - - /** The reference dataset URI. */ - @JsonProperty("referenceDatasetUri") - @ExcludeMissing - fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { - this.referenceDatasetUri = referenceDatasetUri - } - - /** 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)) - - /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - /** The storage type. */ - fun storageType(storageType: StorageType) = storageType(JsonField.of(storageType)) - - /** The storage type. */ - @JsonProperty("storageType") - @ExcludeMissing - fun storageType(storageType: JsonField) = apply { - this.storageType = storageType - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): ProjectInferencePipelineCreateResponse = - ProjectInferencePipelineCreateResponse( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - referenceDatasetUri, - status, - statusMessage, - storageType, - links, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = Links.Builder::class) - @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun app(): String = app.getRequired("app") - - @JsonProperty("app") @ExcludeMissing fun _app() = app - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Links = apply { - if (!validated) { - app() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var app: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) - } - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val QUEUED = Status(JsonField.of("queued")) - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PAUSED = Status(JsonField.of("paused")) - - @JvmField val FAILED = Status(JsonField.of("failed")) - - @JvmField val COMPLETED = Status(JsonField.of("completed")) - - @JvmField val UNKNOWN = Status(JsonField.of("unknown")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - } - - enum class Value { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - _UNKNOWN, - } - - 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 - } - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - } - - class StorageType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StorageType && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val LOCAL = StorageType(JsonField.of("local")) - - @JvmField val S3 = StorageType(JsonField.of("s3")) - - @JvmField val GCS = StorageType(JsonField.of("gcs")) - - @JvmField val AZURE = StorageType(JsonField.of("azure")) - - @JvmStatic fun of(value: String) = StorageType(JsonField.of(value)) - } - - enum class Known { - LOCAL, - S3, - GCS, - AZURE, - } - - enum class Value { - LOCAL, - S3, - GCS, - AZURE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - LOCAL -> Value.LOCAL - S3 -> Value.S3 - GCS -> Value.GCS - AZURE -> Value.AZURE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - LOCAL -> Known.LOCAL - S3 -> Known.S3 - GCS -> Known.GCS - AZURE -> Known.AZURE - else -> throw OpenlayerInvalidDataException("Unknown StorageType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } -} 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 deleted file mode 100644 index a7d94dc..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ /dev/null @@ -1,194 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional - -class ProjectInferencePipelineListParams -constructor( - private val id: String, - private val name: String?, - private val page: Long?, - private val perPage: Long?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun id(): String = id - - fun name(): Optional = Optional.ofNullable(name) - - fun page(): Optional = Optional.ofNullable(page) - - fun perPage(): Optional = Optional.ofNullable(perPage) - - @JvmSynthetic - internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.name?.let { params.put("name", listOf(it.toString())) } - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() - } - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> id - else -> "" - } - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListParams && - this.id == other.id && - this.name == other.name && - this.page == other.page && - this.perPage == other.perPage && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int { - return Objects.hash( - id, - name, - page, - perPage, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) - } - - override fun toString() = - "ProjectInferencePipelineListParams{id=$id, name=$name, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var id: String? = null - private var name: String? = null - private var page: Long? = null - private var perPage: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = - apply { - this.id = projectInferencePipelineListParams.id - this.name = projectInferencePipelineListParams.name - this.page = projectInferencePipelineListParams.page - this.perPage = projectInferencePipelineListParams.perPage - additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) - additionalHeaders(projectInferencePipelineListParams.additionalHeaders) - additionalBodyProperties( - projectInferencePipelineListParams.additionalBodyProperties - ) - } - - fun id(id: String) = apply { this.id = id } - - /** Filter list of items by name. */ - fun name(name: String) = apply { this.name = name } - - /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } - - /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) - } - - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) - } - - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) - } - - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } - - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - this.additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectInferencePipelineListParams = - ProjectInferencePipelineListParams( - checkNotNull(id) { "`id` is required but was not set" }, - name, - page, - perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } -} 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 deleted file mode 100644 index 2d678f9..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ /dev/null @@ -1,1017 +0,0 @@ -// 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.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.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional - -@JsonDeserialize(builder = ProjectInferencePipelineListResponse.Builder::class) -@NoAutoDetect -class ProjectInferencePipelineListResponse -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun _meta(): _Meta = _meta.getRequired("_meta") - - fun items(): List = items.getRequired("items") - - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - - @JsonProperty("items") @ExcludeMissing fun _items() = items - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): ProjectInferencePipelineListResponse = apply { - if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var _meta: JsonField<_Meta> = JsonMissing.of() - private var items: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - projectInferencePipelineListResponse: ProjectInferencePipelineListResponse - ) = apply { - this._meta = projectInferencePipelineListResponse._meta - this.items = projectInferencePipelineListResponse.items - additionalProperties(projectInferencePipelineListResponse.additionalProperties) - } - - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - @JsonProperty("_meta") - @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - - fun items(items: List) = items(JsonField.of(items)) - - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } - - 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(): ProjectInferencePipelineListResponse = - ProjectInferencePipelineListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = _Meta.Builder::class) - @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The current page. */ - fun page(): Long = page.getRequired("page") - - /** The number of items per page. */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** The total number of items. */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** The total number of pages. */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page - - /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage - - /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems - - /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): _Meta = apply { - if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var page: JsonField = JsonMissing.of() - private var perPage: JsonField = JsonMissing.of() - private var totalItems: JsonField = JsonMissing.of() - private var totalPages: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - this.page = _meta.page - this.perPage = _meta.perPage - this.totalItems = _meta.totalItems - this.totalPages = _meta.totalPages - additionalProperties(_meta.additionalProperties) - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - 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(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) - } - } - - @JsonDeserialize(builder = Item.Builder::class) - @NoAutoDetect - class Item - private constructor( - private val id: JsonField, - private val projectId: 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 referenceDatasetUri: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val storageType: JsonField, - private val links: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The inference pipeline id. */ - fun id(): String = id.getRequired("id") - - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** 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 data sample received date. */ - fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - - /** 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 next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - - /** 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 reference dataset URI. */ - fun referenceDatasetUri(): Optional = - Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) - - /** 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 storage type. */ - fun storageType(): Optional = - Optional.ofNullable(storageType.getNullable("storageType")) - - fun links(): Links = links.getRequired("links") - - /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - - /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** 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") - @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 - - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun _dateOfNextEvaluation() = dateOfNextEvaluation - - /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount - - /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount - - /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount - - /** The reference dataset URI. */ - @JsonProperty("referenceDatasetUri") - @ExcludeMissing - fun _referenceDatasetUri() = referenceDatasetUri - - /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - /** The storage type. */ - @JsonProperty("storageType") @ExcludeMissing fun _storageType() = storageType - - @JsonProperty("links") @ExcludeMissing fun _links() = links - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Item = apply { - if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - referenceDatasetUri() - status() - statusMessage() - storageType() - links().validate() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.referenceDatasetUri == other.referenceDatasetUri && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.storageType == other.storageType && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - referenceDatasetUri, - status, - statusMessage, - storageType, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Item{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, referenceDatasetUri=$referenceDatasetUri, status=$status, statusMessage=$statusMessage, storageType=$storageType, links=$links, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - private var projectId: 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 referenceDatasetUri: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var storageType: 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.projectId = item.projectId - 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.referenceDatasetUri = item.referenceDatasetUri - this.status = item.status - this.statusMessage = item.statusMessage - this.storageType = item.storageType - this.links = item.links - additionalProperties(item.additionalProperties) - } - - /** 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 inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - - /** 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 - } - - /** 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.of(description)) - - /** 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 last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated - } - - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) - - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } - - /** 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 total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } - - /** The reference dataset URI. */ - fun referenceDatasetUri(referenceDatasetUri: String) = - referenceDatasetUri(JsonField.of(referenceDatasetUri)) - - /** The reference dataset URI. */ - @JsonProperty("referenceDatasetUri") - @ExcludeMissing - fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { - this.referenceDatasetUri = referenceDatasetUri - } - - /** 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)) - - /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - /** The storage type. */ - fun storageType(storageType: StorageType) = storageType(JsonField.of(storageType)) - - /** The storage type. */ - @JsonProperty("storageType") - @ExcludeMissing - fun storageType(storageType: JsonField) = apply { - this.storageType = storageType - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Item = - Item( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - referenceDatasetUri, - status, - statusMessage, - storageType, - links, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = Links.Builder::class) - @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun app(): String = app.getRequired("app") - - @JsonProperty("app") @ExcludeMissing fun _app() = app - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Links = apply { - if (!validated) { - app() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var app: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) - } - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val QUEUED = Status(JsonField.of("queued")) - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PAUSED = Status(JsonField.of("paused")) - - @JvmField val FAILED = Status(JsonField.of("failed")) - - @JvmField val COMPLETED = Status(JsonField.of("completed")) - - @JvmField val UNKNOWN = Status(JsonField.of("unknown")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - } - - enum class Value { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - _UNKNOWN, - } - - 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 - } - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - } - - class StorageType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StorageType && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val LOCAL = StorageType(JsonField.of("local")) - - @JvmField val S3 = StorageType(JsonField.of("s3")) - - @JvmField val GCS = StorageType(JsonField.of("gcs")) - - @JvmField val AZURE = StorageType(JsonField.of("azure")) - - @JvmStatic fun of(value: String) = StorageType(JsonField.of(value)) - } - - enum class Known { - LOCAL, - S3, - GCS, - AZURE, - } - - enum class Value { - LOCAL, - S3, - GCS, - AZURE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - LOCAL -> Value.LOCAL - S3 -> Value.S3 - GCS -> Value.GCS - AZURE -> Value.AZURE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - LOCAL -> Known.LOCAL - S3 -> Known.S3 - GCS -> Known.GCS - AZURE -> Known.AZURE - else -> throw OpenlayerInvalidDataException("Unknown StorageType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - } -} 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 9f53829..39d03aa 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 @@ -4,26 +4,4 @@ package com.openlayer.api.services.async.projects -import com.openlayer.api.core.RequestOptions -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 java.util.concurrent.CompletableFuture - -interface InferencePipelineServiceAsync { - - /** Create an inference pipeline under a project. */ - @JvmOverloads - fun create( - params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture - - /** List the inference pipelines in a project. */ - @JvmOverloads - fun list( - params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} +interface InferencePipelineServiceAsync 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 7c01cde..77cb45d 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,20 +3,9 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.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.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl constructor( @@ -24,65 +13,4 @@ constructor( ) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Create an inference pipeline under a project. */ - override fun create( - params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 e9fb6bf..e1f61c9 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 @@ -4,25 +4,4 @@ package com.openlayer.api.services.blocking.projects -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse -import com.openlayer.api.models.ProjectInferencePipelineListParams -import com.openlayer.api.models.ProjectInferencePipelineListResponse - -interface InferencePipelineService { - - /** Create an inference pipeline under a project. */ - @JvmOverloads - fun create( - params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectInferencePipelineCreateResponse - - /** List the inference pipelines in a project. */ - @JvmOverloads - fun list( - params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectInferencePipelineListResponse -} +interface InferencePipelineService 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 bb3414c..3b4bc5d 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,19 +3,9 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.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.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class InferencePipelineServiceImpl constructor( @@ -23,63 +13,4 @@ constructor( ) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Create an inference pipeline under a project. */ - override fun create( - params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions - ): ProjectInferencePipelineCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } } 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 deleted file mode 100644 index fc267a2..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class ProjectInferencePipelineCreateParamsTest { - - @Test - fun createProjectInferencePipelineCreateParams() { - ProjectInferencePipelineCreateParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .referenceDatasetUri("s3://...") - .storageType(ProjectInferencePipelineCreateParams.StorageType.LOCAL) - .build() - } - - @Test - fun getBody() { - val params = - ProjectInferencePipelineCreateParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .referenceDatasetUri("s3://...") - .storageType(ProjectInferencePipelineCreateParams.StorageType.LOCAL) - .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("s3://...") - assertThat(body.storageType()) - .isEqualTo(ProjectInferencePipelineCreateParams.StorageType.LOCAL) - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = - ProjectInferencePipelineCreateParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("production") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("production") - } - - @Test - fun getPathParam() { - val params = - ProjectInferencePipelineCreateParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("production") - .build() - assertThat(params).isNotNull - // path param "id" - 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/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt deleted file mode 100644 index 506e8ca..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt +++ /dev/null @@ -1,77 +0,0 @@ -// 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 ProjectInferencePipelineCreateResponseTest { - - @Test - fun createProjectInferencePipelineCreateResponse() { - val projectInferencePipelineCreateResponse = - ProjectInferencePipelineCreateResponse.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(123L) - .links( - ProjectInferencePipelineCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .name("production") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .referenceDatasetUri("s3://...") - .storageType(ProjectInferencePipelineCreateResponse.StorageType.LOCAL) - .build() - assertThat(projectInferencePipelineCreateResponse).isNotNull - assertThat(projectInferencePipelineCreateResponse.id()) - .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.dateCreated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateUpdated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.description()) - .contains("This pipeline is used for production.") - assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) - assertThat(projectInferencePipelineCreateResponse.links()) - .isEqualTo( - ProjectInferencePipelineCreateResponse.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(123L) - assertThat(projectInferencePipelineCreateResponse.projectId()) - .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.status()) - .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) - assertThat(projectInferencePipelineCreateResponse.statusMessage()) - .contains("Tests successfully evaluated") - assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) - assertThat(projectInferencePipelineCreateResponse.referenceDatasetUri()) - .contains("s3://...") - assertThat(projectInferencePipelineCreateResponse.storageType()) - .contains(ProjectInferencePipelineCreateResponse.StorageType.LOCAL) - } -} 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 deleted file mode 100644 index 14617b0..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt +++ /dev/null @@ -1,59 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class ProjectInferencePipelineListParamsTest { - - @Test - fun createProjectInferencePipelineListParams() { - ProjectInferencePipelineListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") - .page(123L) - .perPage(100L) - .build() - } - - @Test - fun getQueryParams() { - val params = - ProjectInferencePipelineListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("string")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getQueryParamsWithoutOptionalFields() { - val params = - ProjectInferencePipelineListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getPathParam() { - val params = - ProjectInferencePipelineListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "id" - 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/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt deleted file mode 100644 index bb7a9ef..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt +++ /dev/null @@ -1,98 +0,0 @@ -// 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 ProjectInferencePipelineListResponseTest { - - @Test - fun createProjectInferencePipelineListResponse() { - val projectInferencePipelineListResponse = - ProjectInferencePipelineListResponse.builder() - ._meta( - ProjectInferencePipelineListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .referenceDatasetUri("s3://...") - .storageType( - ProjectInferencePipelineListResponse.Item.StorageType.LOCAL - ) - .build() - ) - ) - .build() - assertThat(projectInferencePipelineListResponse).isNotNull - assertThat(projectInferencePipelineListResponse._meta()) - .isEqualTo( - ProjectInferencePipelineListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(projectInferencePipelineListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .referenceDatasetUri("s3://...") - .storageType(ProjectInferencePipelineListResponse.Item.StorageType.LOCAL) - .build() - ) - } -} 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 22e13d5..778a046 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 @@ -3,54 +3,7 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* -import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class InferencePipelineServiceTest { - - @Test - fun callCreate() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineCreateResponse = - inferencePipelineService.create( - ProjectInferencePipelineCreateParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .referenceDatasetUri("s3://...") - .storageType(ProjectInferencePipelineCreateParams.StorageType.LOCAL) - .build() - ) - println(projectInferencePipelineCreateResponse) - projectInferencePipelineCreateResponse.validate() - } - - @Test - fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineListResponse = - inferencePipelineService.list( - ProjectInferencePipelineListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") - .page(123L) - .perPage(100L) - .build() - ) - println(projectInferencePipelineListResponse) - projectInferencePipelineListResponse.validate() - } -} +@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest From 8edaa4b24bf2b90d987ed7f64d2f789016f0f2ef Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 20:17:32 +0000 Subject: [PATCH 03/21] feat(api): OpenAPI spec update via Stainless API (#8) --- .stats.yml | 2 +- README.md | 34 +- .../api/models/CommitTestResultListParams.kt | 377 --- .../models/CommitTestResultListResponse.kt | 1664 ------------ .../InferencePipelineDataStreamParams.kt | 2236 ----------------- .../InferencePipelineDataStreamResponse.kt | 161 -- .../InferencePipelineTestResultListParams.kt | 379 --- ...InferencePipelineTestResultListResponse.kt | 1666 ------------ .../api/models/ProjectCommitListParams.kt | 179 -- .../api/models/ProjectCommitListResponse.kt | 1308 ---------- .../api/models/ProjectCreateParams.kt | 94 +- .../api/models/ProjectCreateResponse.kt | 130 +- .../api/models/ProjectListResponse.kt | 129 +- .../async/commits/TestResultServiceAsync.kt | 15 +- .../commits/TestResultServiceAsyncImpl.kt | 38 - .../inferencePipelines/DataServiceAsync.kt | 15 +- .../DataServiceAsyncImpl.kt | 40 - .../TestResultServiceAsync.kt | 15 +- .../TestResultServiceAsyncImpl.kt | 38 - .../async/projects/CommitServiceAsync.kt | 15 +- .../async/projects/CommitServiceAsyncImpl.kt | 38 - .../blocking/commits/TestResultService.kt | 14 +- .../blocking/commits/TestResultServiceImpl.kt | 36 - .../inferencePipelines/DataService.kt | 14 +- .../inferencePipelines/DataServiceImpl.kt | 38 - .../inferencePipelines/TestResultService.kt | 14 +- .../TestResultServiceImpl.kt | 36 - .../blocking/projects/CommitService.kt | 14 +- .../blocking/projects/CommitServiceImpl.kt | 36 - .../models/CommitTestResultListParamsTest.kt | 61 - .../CommitTestResultListResponseTest.kt | 161 -- .../InferencePipelineDataStreamParamsTest.kt | 158 -- ...InferencePipelineDataStreamResponseTest.kt | 20 - ...ferencePipelineTestResultListParamsTest.kt | 71 - ...rencePipelineTestResultListResponseTest.kt | 167 -- .../api/models/ProjectCommitListParamsTest.kt | 52 - .../models/ProjectCommitListResponseTest.kt | 124 - .../api/models/ProjectCreateParamsTest.kt | 9 - .../api/models/ProjectCreateResponseTest.kt | 10 - .../api/models/ProjectListResponseTest.kt | 10 - .../api/services/ErrorHandlingTest.kt | 597 ++--- .../api/services/ServiceParamsTest.kt | 92 +- .../services/blocking/ProjectServiceTest.kt | 3 - .../blocking/commits/TestResultServiceTest.kt | 29 +- .../inferencePipelines/DataServiceTest.kt | 52 +- .../TestResultServiceTest.kt | 29 +- .../blocking/projects/CommitServiceTest.kt | 26 +- 47 files changed, 356 insertions(+), 10090 deletions(-) delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt 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/InferencePipelineTestResultListParamsTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 2b7dbf3..fcbfe48 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 6 +configured_endpoints: 2 diff --git a/README.md b/README.md index 4a4d0de..6885a35 100644 --- a/README.md +++ b/README.md @@ -68,25 +68,15 @@ Read the documentation for more configuration options. ### Example: creating a resource -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. +To create a new project, first use the `ProjectCreateParams` builder to specify attributes, +then pass that to the `create` method of the `projects` service. ```java -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; -import java.util.List; - -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() - .rows(List.of(InferencePipelineDataStreamParams.Row.builder().build())) - .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .costColumnName("cost") - .inputVariableNames(List.of("user_query")) - .numOfTokenColumnName("tokens") - .timestampColumnName("timestamp") - .build())) - .build(); -InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream(params); +import com.openlayer.api.models.ProjectCreateParams; +import com.openlayer.api.models.ProjectCreateResponse; + +ProjectCreateParams params = ProjectCreateParams.builder().build(); +ProjectCreateResponse projectCreateResponse = client.projects().create(params); ``` --- @@ -97,14 +87,14 @@ InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client 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. +In [Example: creating a resource](#example-creating-a-resource) above, we used the `ProjectCreateParams.builder()` to pass to +the `create` method of the `projects` 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. ```java -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +ProjectCreateParams params = ProjectCreateParams.builder() // ... normal properties .putAdditionalProperty("secret_param", "4242") .build(); @@ -117,7 +107,7 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui 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 -InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream().validate(); +ProjectCreateResponse projectCreateResponse = client.projects().create().validate(); ``` ### Response properties as JSON @@ -147,7 +137,7 @@ if (field.isMissing()) { 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: ```java -JsonValue secret = inferencePipelineDataStreamResponse._additionalProperties().get("secret_field"); +JsonValue secret = projectCreateResponse._additionalProperties().get("secret_field"); ``` --- 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 deleted file mode 100644 index 5337a3c..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ /dev/null @@ -1,377 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.fasterxml.jackson.annotation.JsonCreator -import com.openlayer.api.core.Enum -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional - -class CommitTestResultListParams -constructor( - private val id: String, - private val includeArchived: Boolean?, - private val page: Long?, - private val perPage: Long?, - private val status: Status?, - private val type: Type?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun id(): String = id - - fun includeArchived(): Optional = Optional.ofNullable(includeArchived) - - fun page(): Optional = Optional.ofNullable(page) - - fun perPage(): Optional = Optional.ofNullable(perPage) - - fun status(): Optional = Optional.ofNullable(status) - - fun type(): Optional = Optional.ofNullable(type) - - @JvmSynthetic - internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.includeArchived?.let { params.put("includeArchived", listOf(it.toString())) } - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - this.status?.let { params.put("status", listOf(it.toString())) } - this.type?.let { params.put("type", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() - } - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> id - else -> "" - } - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListParams && - this.id == other.id && - this.includeArchived == other.includeArchived && - this.page == other.page && - this.perPage == other.perPage && - this.status == other.status && - this.type == other.type && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int { - return Objects.hash( - id, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) - } - - override fun toString() = - "CommitTestResultListParams{id=$id, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var id: String? = null - private var includeArchived: Boolean? = null - private var page: Long? = null - private var perPage: Long? = null - private var status: Status? = null - private var type: Type? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commitTestResultListParams: CommitTestResultListParams) = apply { - this.id = commitTestResultListParams.id - this.includeArchived = commitTestResultListParams.includeArchived - this.page = commitTestResultListParams.page - this.perPage = commitTestResultListParams.perPage - this.status = commitTestResultListParams.status - this.type = commitTestResultListParams.type - additionalQueryParams(commitTestResultListParams.additionalQueryParams) - additionalHeaders(commitTestResultListParams.additionalHeaders) - additionalBodyProperties(commitTestResultListParams.additionalBodyProperties) - } - - fun id(id: String) = apply { this.id = id } - - /** Include archived goals. */ - fun includeArchived(includeArchived: Boolean) = apply { - this.includeArchived = includeArchived - } - - /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } - - /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } - - /** - * 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 objects by test type. Available types are `integrity`, `consistency`, - * `performance`, `fairness`, and `robustness`. - */ - fun type(type: Type) = apply { this.type = type } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) - } - - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) - } - - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) - } - - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } - - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - this.additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): CommitTestResultListParams = - CommitTestResultListParams( - checkNotNull(id) { "`id` is required but was not set" }, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PASSING = Status(JsonField.of("passing")) - - @JvmField val FAILING = Status(JsonField.of("failing")) - - @JvmField val SKIPPED = Status(JsonField.of("skipped")) - - @JvmField val ERROR = Status(JsonField.of("error")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - } - - enum class Value { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val INTEGRITY = Type(JsonField.of("integrity")) - - @JvmField val CONSISTENCY = Type(JsonField.of("consistency")) - - @JvmField val PERFORMANCE = Type(JsonField.of("performance")) - - @JvmField val FAIRNESS = Type(JsonField.of("fairness")) - - @JvmField val ROBUSTNESS = Type(JsonField.of("robustness")) - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - enum class Known { - INTEGRITY, - CONSISTENCY, - PERFORMANCE, - FAIRNESS, - ROBUSTNESS, - } - - enum class Value { - INTEGRITY, - CONSISTENCY, - PERFORMANCE, - FAIRNESS, - ROBUSTNESS, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - INTEGRITY -> Value.INTEGRITY - CONSISTENCY -> Value.CONSISTENCY - PERFORMANCE -> Value.PERFORMANCE - FAIRNESS -> Value.FAIRNESS - ROBUSTNESS -> Value.ROBUSTNESS - else -> Value._UNKNOWN - } - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - } -} 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 deleted file mode 100644 index 731f3b5..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ /dev/null @@ -1,1664 +0,0 @@ -// 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.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.NoAutoDetect -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.toUnmodifiable -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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun _meta(): _Meta = _meta.getRequired("_meta") - - fun items(): List = items.getRequired("items") - - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - - @JsonProperty("items") @ExcludeMissing fun _items() = items - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): CommitTestResultListResponse = apply { - if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var _meta: JsonField<_Meta> = JsonMissing.of() - private var items: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commitTestResultListResponse: CommitTestResultListResponse) = apply { - this._meta = commitTestResultListResponse._meta - this.items = commitTestResultListResponse.items - additionalProperties(commitTestResultListResponse.additionalProperties) - } - - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - @JsonProperty("_meta") - @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - - fun items(items: List) = items(JsonField.of(items)) - - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } - - 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(): CommitTestResultListResponse = - CommitTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = _Meta.Builder::class) - @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The current page. */ - fun page(): Long = page.getRequired("page") - - /** The number of items per page. */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** The total number of items. */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** The total number of pages. */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page - - /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage - - /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems - - /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): _Meta = apply { - if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var page: JsonField = JsonMissing.of() - private var perPage: JsonField = JsonMissing.of() - private var totalItems: JsonField = JsonMissing.of() - private var totalPages: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - this.page = _meta.page - this.perPage = _meta.perPage - this.totalItems = _meta.totalItems - this.totalPages = _meta.totalPages - additionalProperties(_meta.additionalProperties) - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - 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(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) - } - } - - @JsonDeserialize(builder = Item.Builder::class) - @NoAutoDetect - class Item - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** 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 start date. */ - fun dateDataStarts(): Optional = - Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) - - /** The data end date. */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) - - /** The status of the test. */ - fun status(): Status = status.getRequired("status") - - /** The status message. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) - - /** Project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - @JsonProperty("goal") @ExcludeMissing fun _goal() = goal - - /** The test id. */ - @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId - - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId - - /** The inference pipeline id. */ - @JsonProperty("inferencePipelineId") - @ExcludeMissing - fun _inferencePipelineId() = inferencePipelineId - - /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The data start date. */ - @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts - - /** The data end date. */ - @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds - - /** The status of the test. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - /** The status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Item = apply { - if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - 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) - } - - /** 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 test id. */ - fun goalId(goalId: String) = goalId(JsonField.of(goalId)) - - /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun goalId(goalId: JsonField) = apply { this.goalId = goalId } - - /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = - projectVersionId(JsonField.of(projectVersionId)) - - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun projectVersionId(projectVersionId: JsonField) = apply { - this.projectVersionId = projectVersionId - } - - /** 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 creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } - - /** 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 data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun dateDataStarts(dateDataStarts: JsonField) = apply { - this.dateDataStarts = dateDataStarts - } - - /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = - dateDataEnds(JsonField.of(dateDataEnds)) - - /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun dateDataEnds(dateDataEnds: JsonField) = apply { - this.dateDataEnds = dateDataEnds - } - - /** 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)) - - /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - 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(): Item = - Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PASSING = Status(JsonField.of("passing")) - - @JvmField val FAILING = Status(JsonField.of("failing")) - - @JvmField val SKIPPED = Status(JsonField.of("skipped")) - - @JvmField val ERROR = Status(JsonField.of("error")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - } - - enum class Value { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = Goal.Builder::class) - @NoAutoDetect - class Goal - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The test id. */ - fun id(): String = id.getRequired("id") - - /** The test number. */ - fun number(): Long = number.getRequired("number") - - /** The test 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 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 subtype. */ - fun subtype(): String = subtype.getRequired("subtype") - - /** The test creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) - - /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(): Optional = - Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) - - fun thresholds(): List = thresholds.getRequired("thresholds") - - /** 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 number of comments on the test. */ - fun commentCount(): Long = commentCount.getRequired("commentCount") - - /** 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 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")) - - /** The test id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The test number. */ - @JsonProperty("number") @ExcludeMissing fun _number() = number - - /** The test name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = 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") - @ExcludeMissing - fun _evaluationWindow() = evaluationWindow - - /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow - - /** The test type. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type - - /** The test subtype. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype - - /** The test creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") - @ExcludeMissing - fun _originProjectVersionId() = originProjectVersionId - - @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds - - /** Whether the test is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = 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 number of comments on the test. */ - @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount - - /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel - - /** Whether the test uses a validation dataset. */ - @JsonProperty("usesValidationDataset") - @ExcludeMissing - fun _usesValidationDataset() = usesValidationDataset - - /** Whether the test uses a training dataset. */ - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - fun _usesTrainingDataset() = usesTrainingDataset - - /** Whether the test uses a reference dataset (monitoring mode only). */ - @JsonProperty("usesReferenceDataset") - @ExcludeMissing - fun _usesReferenceDataset() = usesReferenceDataset - - /** Whether the test uses production data (monitoring mode only). */ - @JsonProperty("usesProductionData") - @ExcludeMissing - fun _usesProductionData() = usesProductionData - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - 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 - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - 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, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - 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 archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var suggested: JsonField = JsonMissing.of() - private var commentCount: 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 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) - } - - /** 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 test number. */ - @JsonProperty("number") - @ExcludeMissing - fun number(number: JsonField) = apply { this.number = number } - - /** The test name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - - /** 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 - } - - /** 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 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 evaluation window in seconds. Only applies to tests that use production data. - */ - @JsonProperty("evaluationWindow") - @ExcludeMissing - fun evaluationWindow(evaluationWindow: JsonField) = apply { - this.evaluationWindow = evaluationWindow - } - - /** The delay window in seconds. Only applies to tests that use production data. */ - fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) - - /** 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 type. */ - fun type(type: String) = type(JsonField.of(type)) - - /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - /** 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)) - - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") - @ExcludeMissing - fun originProjectVersionId(originProjectVersionId: JsonField) = apply { - this.originProjectVersionId = originProjectVersionId - } - - fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) - - @JsonProperty("thresholds") - @ExcludeMissing - fun thresholds(thresholds: JsonField>) = apply { - this.thresholds = thresholds - } - - /** 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 date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived - } - - /** Whether the test is suggested or user-created. */ - fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) - - /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun suggested(suggested: JsonField) = apply { this.suggested = suggested } - - /** The number of comments on the test. */ - fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) - - /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun commentCount(commentCount: JsonField) = apply { - this.commentCount = commentCount - } - - /** 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 a training dataset. */ - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { - this.usesTrainingDataset = usesTrainingDataset - } - - /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = - 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 production data (monitoring mode only). */ - @JsonProperty("usesProductionData") - @ExcludeMissing - fun usesProductionData(usesProductionData: JsonField) = apply { - this.usesProductionData = usesProductionData - } - - 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(): Goal = - Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = Threshold.Builder::class) - @NoAutoDetect - class Threshold - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** 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")) - - fun insightParameters(): Optional> = - Optional.ofNullable(insightParameters.getNullable("insightParameters")) - - /** The operator to be used for the evaluation. */ - fun operator(): Optional = - Optional.ofNullable(operator.getNullable("operator")) - - /** 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("insightParameters") - @ExcludeMissing - fun _insightParameters() = insightParameters - - /** The operator to be used for the evaluation. */ - @JsonProperty("operator") @ExcludeMissing fun _operator() = operator - - /** The value to be compared. */ - @JsonProperty("value") @ExcludeMissing fun _value() = value - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Threshold = apply { - if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var measurement: JsonField = JsonMissing.of() - private var insightName: JsonField = JsonMissing.of() - private var insightParameters: 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 - } - - /** 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 - } - - fun insightParameters(insightParameters: List) = - insightParameters(JsonField.of(insightParameters)) - - @JsonProperty("insightParameters") - @ExcludeMissing - fun insightParameters(insightParameters: JsonField>) = apply { - this.insightParameters = insightParameters - } - - /** 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 } - - 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(): Threshold = - Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, - private val string: String? = null, - private val strings: List? = null, - private val _json: JsonValue? = null, - ) { - - private var validated: Boolean = false - - fun double(): Optional = Optional.ofNullable(double) - - fun boolean(): Optional = Optional.ofNullable(boolean) - - fun string(): Optional = Optional.ofNullable(string) - - fun strings(): Optional> = Optional.ofNullable(strings) - - fun isDouble(): Boolean = double != null - - fun isBoolean(): Boolean = boolean != null - - fun isString(): Boolean = string != null - - fun isStrings(): Boolean = strings != null - - fun asDouble(): Double = double.getOrThrow("double") - - fun asBoolean(): Boolean = boolean.getOrThrow("boolean") - - fun asString(): String = string.getOrThrow("string") - - fun asStrings(): List = strings.getOrThrow("strings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T { - return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) - string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - else -> visitor.unknown(_json) - } - } - - fun validate(): Value = apply { - if (!validated) { - if ( - double == null && - boolean == null && - string == null && - strings == null - ) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings - } - - override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) - } - - override fun toString(): String { - return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" - string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - } - - companion object { - - @JvmStatic fun ofDouble(double: Double) = Value(double = double) - - @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - - @JvmStatic fun ofString(string: String) = Value(string = string) - - @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) - } - - interface Visitor { - - fun visitDouble(double: Double): T - - fun visitBoolean(boolean: Boolean): T - - fun visitString(string: String): T - - fun visitStrings(strings: List): T - - fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") - } - } - - class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) - } - } - - class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider - ) { - when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) - 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") - } - } - } - } - } - } - } -} 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 deleted file mode 100644 index 3efe054..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ /dev/null @@ -1,2236 +0,0 @@ -// 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.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.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.getOrThrow -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional - -class InferencePipelineDataStreamParams -constructor( - private val id: String, - private val config: Config, - private val rows: List, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun id(): String = id - - fun config(): Config = config - - fun rows(): List = rows - - @JvmSynthetic - internal fun getBody(): InferencePipelineDataStreamBody { - return InferencePipelineDataStreamBody( - config, - rows, - additionalBodyProperties, - ) - } - - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> id - else -> "" - } - } - - @JsonDeserialize(builder = InferencePipelineDataStreamBody.Builder::class) - @NoAutoDetect - class InferencePipelineDataStreamBody - internal constructor( - private val config: Config?, - private val rows: List?, - private val additionalProperties: Map, - ) { - - private var hashCode: Int = 0 - - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - @JsonProperty("config") fun config(): Config? = config - - /** A list of entries that represent rows of a csv file */ - @JsonProperty("rows") fun rows(): List? = rows - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamBody && - this.config == other.config && - this.rows == other.rows && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - config, - rows, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var config: Config? = null - private var rows: List? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = - apply { - this.config = inferencePipelineDataStreamBody.config - this.rows = inferencePipelineDataStreamBody.rows - additionalProperties(inferencePipelineDataStreamBody.additionalProperties) - } - - /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. - */ - @JsonProperty("config") fun config(config: Config) = apply { this.config = config } - - /** A list of entries that represent rows of a csv file */ - @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } - - 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(): InferencePipelineDataStreamBody = - InferencePipelineDataStreamBody( - checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), - additionalProperties.toUnmodifiable(), - ) - } - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamParams && - this.id == other.id && - this.config == other.config && - this.rows == other.rows && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int { - return Objects.hash( - id, - config, - rows, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) - } - - override fun toString() = - "InferencePipelineDataStreamParams{id=$id, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var id: String? = null - private var config: Config? = null - private var rows: MutableList = mutableListOf() - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = - apply { - this.id = inferencePipelineDataStreamParams.id - this.config = inferencePipelineDataStreamParams.config - this.rows(inferencePipelineDataStreamParams.rows) - additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) - additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) - additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) - } - - fun id(id: String) = apply { this.id = id } - - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(config: Config) = apply { this.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) } - - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(tabularClassificationData: Config.TabularClassificationData) = apply { - this.config = Config.ofTabularClassificationData(tabularClassificationData) - } - - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(tabularRegressionData: Config.TabularRegressionData) = apply { - this.config = Config.ofTabularRegressionData(tabularRegressionData) - } - - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(textClassificationData: Config.TextClassificationData) = apply { - this.config = Config.ofTextClassificationData(textClassificationData) - } - - /** A list of entries that represent rows of a csv file */ - fun rows(rows: List) = apply { - this.rows.clear() - this.rows.addAll(rows) - } - - /** A list of entries that represent rows of a csv file */ - fun addRow(row: Row) = apply { this.rows.add(row) } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) - } - - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) - } - - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) - } - - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } - - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - this.additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): InferencePipelineDataStreamParams = - InferencePipelineDataStreamParams( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(using = Config.Deserializer::class) - @JsonSerialize(using = Config.Serializer::class) - class Config - private constructor( - private val llmData: LlmData? = null, - private val tabularClassificationData: TabularClassificationData? = null, - private val tabularRegressionData: TabularRegressionData? = null, - private val textClassificationData: TextClassificationData? = null, - private val _json: JsonValue? = null, - ) { - - private var validated: Boolean = false - - fun llmData(): Optional = Optional.ofNullable(llmData) - - fun tabularClassificationData(): Optional = - Optional.ofNullable(tabularClassificationData) - - fun tabularRegressionData(): Optional = - Optional.ofNullable(tabularRegressionData) - - fun textClassificationData(): Optional = - Optional.ofNullable(textClassificationData) - - fun isLlmData(): Boolean = llmData != null - - fun isTabularClassificationData(): Boolean = tabularClassificationData != null - - fun isTabularRegressionData(): Boolean = tabularRegressionData != null - - fun isTextClassificationData(): Boolean = textClassificationData != null - - fun asLlmData(): LlmData = llmData.getOrThrow("llmData") - - fun asTabularClassificationData(): TabularClassificationData = - tabularClassificationData.getOrThrow("tabularClassificationData") - - fun asTabularRegressionData(): TabularRegressionData = - tabularRegressionData.getOrThrow("tabularRegressionData") - - fun asTextClassificationData(): TextClassificationData = - textClassificationData.getOrThrow("textClassificationData") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T { - return when { - llmData != null -> visitor.visitLlmData(llmData) - tabularClassificationData != null -> - visitor.visitTabularClassificationData(tabularClassificationData) - tabularRegressionData != null -> - visitor.visitTabularRegressionData(tabularRegressionData) - textClassificationData != null -> - visitor.visitTextClassificationData(textClassificationData) - else -> visitor.unknown(_json) - } - } - - 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 - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - this.llmData == other.llmData && - this.tabularClassificationData == other.tabularClassificationData && - this.tabularRegressionData == other.tabularRegressionData && - this.textClassificationData == other.textClassificationData - } - - override fun hashCode(): Int { - return Objects.hash( - llmData, - tabularClassificationData, - tabularRegressionData, - textClassificationData, - ) - } - - override fun toString(): String { - return when { - llmData != null -> "Config{llmData=$llmData}" - tabularClassificationData != null -> - "Config{tabularClassificationData=$tabularClassificationData}" - tabularRegressionData != null -> - "Config{tabularRegressionData=$tabularRegressionData}" - textClassificationData != null -> - "Config{textClassificationData=$textClassificationData}" - _json != null -> "Config{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Config") - } - } - - companion object { - - @JvmStatic fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) - - @JvmStatic - fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = - Config(tabularClassificationData = tabularClassificationData) - - @JvmStatic - fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = - Config(tabularRegressionData = tabularRegressionData) - - @JvmStatic - fun ofTextClassificationData(textClassificationData: TextClassificationData) = - Config(textClassificationData = textClassificationData) - } - - interface Visitor { - - fun visitLlmData(llmData: LlmData): T - - fun visitTabularClassificationData( - tabularClassificationData: TabularClassificationData - ): T - - fun visitTabularRegressionData(tabularRegressionData: TabularRegressionData): T - - fun visitTextClassificationData(textClassificationData: TextClassificationData): T - - fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Config: $json") - } - } - - class Deserializer : BaseDeserializer(Config::class) { - - 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) - } - } - - class Serializer : BaseSerializer(Config::class) { - - override fun serialize( - value: Config, - generator: JsonGenerator, - provider: SerializerProvider - ) { - when { - value.llmData != null -> generator.writeObject(value.llmData) - value.tabularClassificationData != null -> - generator.writeObject(value.tabularClassificationData) - value.tabularRegressionData != null -> - generator.writeObject(value.tabularRegressionData) - value.textClassificationData != null -> - generator.writeObject(value.textClassificationData) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Config") - } - } - } - - @JsonDeserialize(builder = LlmData.Builder::class) - @NoAutoDetect - class LlmData - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(): Optional = - Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) - - /** - * Name of the column with the context retrieved. Applies to RAG use cases. Providing - * the context enables RAG-specific metrics. - */ - fun contextColumnName(): Optional = - Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) - - /** Name of the column with the cost associated with each row. */ - fun costColumnName(): Optional = - Optional.ofNullable(costColumnName.getNullable("costColumnName")) - - /** Name of the column with the ground truths. */ - 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. - */ - fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - - /** Array of input variable names. Each input variable should be a dataset column. */ - fun inputVariableNames(): Optional> = - Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) - - /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) - - /** Name of the column with the model outputs. */ - fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") - - /** Prompt for the LLM. */ - 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. - */ - fun questionColumnName(): Optional = - Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) - - /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. - */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) - - /** Name of the column with the total number of tokens. */ - @JsonProperty("numOfTokenColumnName") - @ExcludeMissing - fun _numOfTokenColumnName() = numOfTokenColumnName - - /** - * 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 - - /** Name of the column with the cost associated with each row. */ - @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName - - /** Name of the column with the ground truths. */ - @JsonProperty("groundTruthColumnName") - @ExcludeMissing - fun _groundTruthColumnName() = 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName - - /** Array of input variable names. Each input variable should be a dataset column. */ - @JsonProperty("inputVariableNames") - @ExcludeMissing - fun _inputVariableNames() = inputVariableNames - - /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - /** Name of the column with the model outputs. */ - @JsonProperty("outputColumnName") - @ExcludeMissing - fun _outputColumnName() = outputColumnName - - /** Prompt for the LLM. */ - @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt - - /** - * 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 - - /** - * 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 - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): LlmData = apply { - if (!validated) { - numOfTokenColumnName() - contextColumnName() - costColumnName() - groundTruthColumnName() - inferenceIdColumnName() - inputVariableNames() - latencyColumnName() - outputColumnName() - prompt().map { it.forEach { it.validate() } } - questionColumnName() - timestampColumnName() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LlmData && - this.numOfTokenColumnName == other.numOfTokenColumnName && - this.contextColumnName == other.contextColumnName && - this.costColumnName == other.costColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.inputVariableNames == other.inputVariableNames && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.outputColumnName == other.outputColumnName && - this.prompt == other.prompt && - this.questionColumnName == other.questionColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames, - latencyColumnName, - metadata, - outputColumnName, - prompt, - questionColumnName, - timestampColumnName, - additionalProperties, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var numOfTokenColumnName: JsonField = JsonMissing.of() - 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 latencyColumnName: JsonField = JsonMissing.of() - private var metadata: JsonValue = JsonMissing.of() - private var outputColumnName: JsonField = JsonMissing.of() - private var prompt: JsonField> = JsonMissing.of() - 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) - } - - /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(numOfTokenColumnName: String) = - numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) - - /** 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 context retrieved. Applies to RAG use cases. - * Providing the context enables RAG-specific metrics. - */ - fun contextColumnName(contextColumnName: String) = - contextColumnName(JsonField.of(contextColumnName)) - - /** - * 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 - } - - /** Name of the column with the cost associated with each row. */ - fun costColumnName(costColumnName: String) = - 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 - } - - /** Name of the column with the ground truths. */ - fun groundTruthColumnName(groundTruthColumnName: String) = - groundTruthColumnName(JsonField.of(groundTruthColumnName)) - - /** Name of the column with the ground truths. */ - @JsonProperty("groundTruthColumnName") - @ExcludeMissing - fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { - this.groundTruthColumnName = 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. - */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = - 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { - this.inferenceIdColumnName = inferenceIdColumnName - } - - /** - * Array of input variable names. Each input variable should be a dataset column. - */ - fun inputVariableNames(inputVariableNames: List) = - inputVariableNames(JsonField.of(inputVariableNames)) - - /** - * Array of input variable names. Each input variable should be a dataset column. - */ - @JsonProperty("inputVariableNames") - @ExcludeMissing - fun inputVariableNames(inputVariableNames: JsonField>) = apply { - this.inputVariableNames = inputVariableNames - } - - /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - 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 model outputs. */ - @JsonProperty("outputColumnName") - @ExcludeMissing - fun outputColumnName(outputColumnName: JsonField) = apply { - this.outputColumnName = outputColumnName - } - - /** 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 } - - /** - * Name of the column with the questions. Applies to RAG use cases. Providing the - * question enables RAG-specific metrics. - */ - fun questionColumnName(questionColumnName: String) = - questionColumnName(JsonField.of(questionColumnName)) - - /** - * 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 - } - - /** - * 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: String) = - 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. - */ - @JsonProperty("timestampColumnName") - @ExcludeMissing - fun timestampColumnName(timestampColumnName: JsonField) = apply { - this.timestampColumnName = timestampColumnName - } - - 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(): LlmData = - LlmData( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames.map { it.toUnmodifiable() }, - latencyColumnName, - metadata, - outputColumnName, - prompt.map { it.toUnmodifiable() }, - questionColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = Prompt.Builder::class) - @NoAutoDetect - class Prompt - private constructor( - private val role: JsonField, - private val content: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** 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 - - /** Content of the prompt. */ - @JsonProperty("content") @ExcludeMissing fun _content() = content - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Prompt = apply { - if (!validated) { - role() - content() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Prompt && - this.role == other.role && - this.content == other.content && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - role, - content, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var role: JsonField = JsonMissing.of() - private var content: 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) - } - - /** 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 } - - 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(): Prompt = - Prompt( - role, - content, - additionalProperties.toUnmodifiable(), - ) - } - } - } - - @JsonDeserialize(builder = TabularClassificationData.Builder::class) - @NoAutoDetect - class TabularClassificationData - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. - */ - 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")) - - /** - * 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(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - - /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. - */ - fun labelColumnName(): Optional = - Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) - - /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) - - /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) - - /** - * Name of the column with the model's predictions as **lists of class probabilities**. - */ - fun predictionScoresColumnName(): Optional = - Optional.ofNullable( - predictionScoresColumnName.getNullable("predictionScoresColumnName") - ) - - /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. - */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) - - /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. - */ - @JsonProperty("categoricalFeatureNames") - @ExcludeMissing - fun _categoricalFeatureNames() = categoricalFeatureNames - - /** - * 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 - - /** Array with all input feature names. */ - @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName - - /** - * 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 - - /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - /** Name of the column with the model's predictions as **zero-indexed integers**. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing - fun _predictionsColumnName() = predictionsColumnName - - /** - * Name of the column with the model's predictions as **lists of class probabilities**. - */ - @JsonProperty("predictionScoresColumnName") - @ExcludeMissing - fun _predictionScoresColumnName() = predictionScoresColumnName - - /** - * 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 - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): TabularClassificationData = apply { - if (!validated) { - categoricalFeatureNames() - classNames() - featureNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - timestampColumnName() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularClassificationData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.classNames == other.classNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - categoricalFeatureNames, - classNames, - featureNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var categoricalFeatureNames: JsonField> = JsonMissing.of() - private var classNames: JsonField> = JsonMissing.of() - private var featureNames: JsonField> = JsonMissing.of() - private var inferenceIdColumnName: JsonField = JsonMissing.of() - private var labelColumnName: JsonField = JsonMissing.of() - private var latencyColumnName: JsonField = JsonMissing.of() - private var metadata: JsonValue = JsonMissing.of() - private var predictionsColumnName: JsonField = JsonMissing.of() - private var predictionScoresColumnName: JsonField = JsonMissing.of() - private var timestampColumnName: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @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 = - tabularClassificationData.predictionScoresColumnName - this.timestampColumnName = tabularClassificationData.timestampColumnName - additionalProperties(tabularClassificationData.additionalProperties) - } - - /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. - */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = - categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) - - /** - * 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 - } - - /** - * 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. - */ - @JsonProperty("classNames") - @ExcludeMissing - fun classNames(classNames: JsonField>) = apply { - this.classNames = classNames - } - - /** 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 - } - - /** - * 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: String) = - 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { - this.inferenceIdColumnName = inferenceIdColumnName - } - - /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. - */ - fun labelColumnName(labelColumnName: String) = - 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`. - */ - @JsonProperty("labelColumnName") - @ExcludeMissing - fun labelColumnName(labelColumnName: JsonField) = apply { - this.labelColumnName = labelColumnName - } - - /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - 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**. */ - fun predictionsColumnName(predictionsColumnName: String) = - 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 - } - - /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. - */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = - predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) - - /** - * 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 - } - - /** - * 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: String) = - 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. - */ - @JsonProperty("timestampColumnName") - @ExcludeMissing - fun timestampColumnName(timestampColumnName: JsonField) = apply { - this.timestampColumnName = timestampColumnName - } - - 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(): TabularClassificationData = - TabularClassificationData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - classNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) - } - } - - @JsonDeserialize(builder = TabularRegressionData.Builder::class) - @NoAutoDetect - class TabularRegressionData - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. - */ - fun categoricalFeatureNames(): Optional> = - Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) - - /** Array with all input feature names. */ - 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. - */ - fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - - /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) - - /** Name of the column with the model's predictions. */ - fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) - - /** Name of the column with the targets (ground truth values). */ - 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. - */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) - - /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. - */ - @JsonProperty("categoricalFeatureNames") - @ExcludeMissing - fun _categoricalFeatureNames() = categoricalFeatureNames - - /** Array with all input feature names. */ - @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName - - /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - /** Name of the column with the model's predictions. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing - fun _predictionsColumnName() = predictionsColumnName - - /** Name of the column with the targets (ground truth values). */ - @JsonProperty("targetColumnName") - @ExcludeMissing - fun _targetColumnName() = targetColumnName - - /** - * 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 - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): TabularRegressionData = apply { - if (!validated) { - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - latencyColumnName() - predictionsColumnName() - targetColumnName() - timestampColumnName() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularRegressionData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.targetColumnName == other.targetColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - categoricalFeatureNames, - featureNames, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var categoricalFeatureNames: JsonField> = JsonMissing.of() - private var featureNames: JsonField> = JsonMissing.of() - private var inferenceIdColumnName: JsonField = JsonMissing.of() - private var latencyColumnName: JsonField = JsonMissing.of() - private var metadata: JsonValue = JsonMissing.of() - private var predictionsColumnName: JsonField = JsonMissing.of() - private var targetColumnName: JsonField = JsonMissing.of() - private var timestampColumnName: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @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) - } - - /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. - */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = - categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) - - /** - * 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 - } - - /** 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 - } - - /** - * 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: String) = - 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { - this.inferenceIdColumnName = inferenceIdColumnName - } - - /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - 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. */ - fun predictionsColumnName(predictionsColumnName: String) = - predictionsColumnName(JsonField.of(predictionsColumnName)) - - /** Name of the column with the model's predictions. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing - fun predictionsColumnName(predictionsColumnName: JsonField) = apply { - this.predictionsColumnName = predictionsColumnName - } - - /** Name of the column with the targets (ground truth values). */ - fun targetColumnName(targetColumnName: String) = - 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 - } - - /** - * 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: String) = - 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. - */ - @JsonProperty("timestampColumnName") - @ExcludeMissing - fun timestampColumnName(timestampColumnName: JsonField) = apply { - this.timestampColumnName = timestampColumnName - } - - 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(): TabularRegressionData = - TabularRegressionData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) - } - } - - @JsonDeserialize(builder = TextClassificationData.Builder::class) - @NoAutoDetect - class TextClassificationData - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** - * 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") - - /** - * 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(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - - /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. - */ - fun labelColumnName(): Optional = - Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) - - /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) - - /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) - - /** - * Name of the column with the model's predictions as **lists of class probabilities**. - */ - fun predictionScoresColumnName(): Optional = - Optional.ofNullable( - predictionScoresColumnName.getNullable("predictionScoresColumnName") - ) - - /** Name of the column with the text data. */ - 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. - */ - 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. - */ - @JsonProperty("classNames") @ExcludeMissing fun _classNames() = 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName - - /** - * 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 - - /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - /** Name of the column with the model's predictions as **zero-indexed integers**. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing - fun _predictionsColumnName() = predictionsColumnName - - /** - * Name of the column with the model's predictions as **lists of class probabilities**. - */ - @JsonProperty("predictionScoresColumnName") - @ExcludeMissing - fun _predictionScoresColumnName() = predictionScoresColumnName - - /** Name of the column with the text data. */ - @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName() = textColumnName - - /** - * 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 - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): TextClassificationData = apply { - if (!validated) { - classNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - textColumnName() - timestampColumnName() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TextClassificationData && - this.classNames == other.classNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.textColumnName == other.textColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - classNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var classNames: JsonField> = JsonMissing.of() - private var inferenceIdColumnName: JsonField = JsonMissing.of() - private var labelColumnName: JsonField = JsonMissing.of() - private var latencyColumnName: JsonField = JsonMissing.of() - private var metadata: JsonValue = JsonMissing.of() - private var predictionsColumnName: JsonField = JsonMissing.of() - private var predictionScoresColumnName: JsonField = JsonMissing.of() - private var textColumnName: JsonField = JsonMissing.of() - private var timestampColumnName: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @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) - } - - /** - * 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. - */ - @JsonProperty("classNames") - @ExcludeMissing - fun classNames(classNames: JsonField>) = apply { - this.classNames = 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. - */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = - 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. - */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { - this.inferenceIdColumnName = inferenceIdColumnName - } - - /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. - */ - fun labelColumnName(labelColumnName: String) = - 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`. - */ - @JsonProperty("labelColumnName") - @ExcludeMissing - fun labelColumnName(labelColumnName: JsonField) = apply { - this.labelColumnName = labelColumnName - } - - /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - 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**. */ - fun predictionsColumnName(predictionsColumnName: String) = - 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 - } - - /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. - */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = - predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) - - /** - * 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 - } - - /** Name of the column with the text data. */ - fun textColumnName(textColumnName: String) = - textColumnName(JsonField.of(textColumnName)) - - /** Name of the column with the text data. */ - @JsonProperty("textColumnName") - @ExcludeMissing - fun textColumnName(textColumnName: JsonField) = apply { - this.textColumnName = textColumnName - } - - /** - * 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: String) = - 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. - */ - @JsonProperty("timestampColumnName") - @ExcludeMissing - fun timestampColumnName(timestampColumnName: JsonField) = apply { - this.timestampColumnName = timestampColumnName - } - - 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(): TextClassificationData = - TextClassificationData( - classNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) - } - } - } - - @JsonDeserialize(builder = Row.Builder::class) - @NoAutoDetect - class Row - private constructor( - private val additionalProperties: Map, - ) { - - private var hashCode: Int = 0 - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Row && this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(additionalProperties) - } - return hashCode - } - - override fun toString() = "Row{additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(row: Row) = apply { additionalProperties(row.additionalProperties) } - - 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(): Row = Row(additionalProperties.toUnmodifiable()) - } - } -} 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 deleted file mode 100644 index 087ceda..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ /dev/null @@ -1,161 +0,0 @@ -// 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.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.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.util.Objects - -@JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) -@NoAutoDetect -class InferencePipelineDataStreamResponse -private constructor( - private val success: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun success(): Success = success.getRequired("success") - - @JsonProperty("success") @ExcludeMissing fun _success() = success - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): InferencePipelineDataStreamResponse = apply { - if (!validated) { - success() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode - } - - override fun toString() = - "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var success: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse - ) = apply { - this.success = inferencePipelineDataStreamResponse.success - additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): InferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) - } - - class Success - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Success && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val TRUE = Success(JsonField.of(true)) - - @JvmStatic fun of(value: Boolean) = Success(JsonField.of(value)) - } - - enum class Known { - TRUE, - } - - enum class Value { - TRUE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - TRUE -> Value.TRUE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - TRUE -> Known.TRUE - else -> throw OpenlayerInvalidDataException("Unknown Success: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } -} 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 deleted file mode 100644 index cb8fb3c..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ /dev/null @@ -1,379 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.fasterxml.jackson.annotation.JsonCreator -import com.openlayer.api.core.Enum -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional - -class InferencePipelineTestResultListParams -constructor( - private val id: String, - private val includeArchived: Boolean?, - private val page: Long?, - private val perPage: Long?, - private val status: Status?, - private val type: Type?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun id(): String = id - - fun includeArchived(): Optional = Optional.ofNullable(includeArchived) - - fun page(): Optional = Optional.ofNullable(page) - - fun perPage(): Optional = Optional.ofNullable(perPage) - - fun status(): Optional = Optional.ofNullable(status) - - fun type(): Optional = Optional.ofNullable(type) - - @JvmSynthetic - internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.includeArchived?.let { params.put("includeArchived", listOf(it.toString())) } - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - this.status?.let { params.put("status", listOf(it.toString())) } - this.type?.let { params.put("type", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() - } - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> id - else -> "" - } - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListParams && - this.id == other.id && - this.includeArchived == other.includeArchived && - this.page == other.page && - this.perPage == other.perPage && - this.status == other.status && - this.type == other.type && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int { - return Objects.hash( - id, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) - } - - override fun toString() = - "InferencePipelineTestResultListParams{id=$id, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var id: String? = null - private var includeArchived: Boolean? = null - private var page: Long? = null - private var perPage: Long? = null - private var status: Status? = null - private var type: Type? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - inferencePipelineTestResultListParams: InferencePipelineTestResultListParams - ) = apply { - this.id = inferencePipelineTestResultListParams.id - this.includeArchived = inferencePipelineTestResultListParams.includeArchived - this.page = inferencePipelineTestResultListParams.page - this.perPage = inferencePipelineTestResultListParams.perPage - this.status = inferencePipelineTestResultListParams.status - this.type = inferencePipelineTestResultListParams.type - additionalQueryParams(inferencePipelineTestResultListParams.additionalQueryParams) - additionalHeaders(inferencePipelineTestResultListParams.additionalHeaders) - additionalBodyProperties(inferencePipelineTestResultListParams.additionalBodyProperties) - } - - fun id(id: String) = apply { this.id = id } - - /** Include archived goals. */ - fun includeArchived(includeArchived: Boolean) = apply { - this.includeArchived = includeArchived - } - - /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } - - /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } - - /** - * 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 objects by test type. Available types are `integrity`, `consistency`, - * `performance`, `fairness`, and `robustness`. - */ - fun type(type: Type) = apply { this.type = type } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) - } - - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) - } - - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) - } - - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } - - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - this.additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): InferencePipelineTestResultListParams = - InferencePipelineTestResultListParams( - checkNotNull(id) { "`id` is required but was not set" }, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PASSING = Status(JsonField.of("passing")) - - @JvmField val FAILING = Status(JsonField.of("failing")) - - @JvmField val SKIPPED = Status(JsonField.of("skipped")) - - @JvmField val ERROR = Status(JsonField.of("error")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - } - - enum class Value { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val INTEGRITY = Type(JsonField.of("integrity")) - - @JvmField val CONSISTENCY = Type(JsonField.of("consistency")) - - @JvmField val PERFORMANCE = Type(JsonField.of("performance")) - - @JvmField val FAIRNESS = Type(JsonField.of("fairness")) - - @JvmField val ROBUSTNESS = Type(JsonField.of("robustness")) - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - enum class Known { - INTEGRITY, - CONSISTENCY, - PERFORMANCE, - FAIRNESS, - ROBUSTNESS, - } - - enum class Value { - INTEGRITY, - CONSISTENCY, - PERFORMANCE, - FAIRNESS, - ROBUSTNESS, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - INTEGRITY -> Value.INTEGRITY - CONSISTENCY -> Value.CONSISTENCY - PERFORMANCE -> Value.PERFORMANCE - FAIRNESS -> Value.FAIRNESS - ROBUSTNESS -> Value.ROBUSTNESS - else -> Value._UNKNOWN - } - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - } -} 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 deleted file mode 100644 index 045ce71..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ /dev/null @@ -1,1666 +0,0 @@ -// 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.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.NoAutoDetect -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.toUnmodifiable -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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun _meta(): _Meta = _meta.getRequired("_meta") - - fun items(): List = items.getRequired("items") - - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - - @JsonProperty("items") @ExcludeMissing fun _items() = items - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): InferencePipelineTestResultListResponse = apply { - if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var _meta: JsonField<_Meta> = JsonMissing.of() - private var items: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse - ) = apply { - this._meta = inferencePipelineTestResultListResponse._meta - this.items = inferencePipelineTestResultListResponse.items - additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) - } - - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - @JsonProperty("_meta") - @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - - fun items(items: List) = items(JsonField.of(items)) - - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } - - 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(): InferencePipelineTestResultListResponse = - InferencePipelineTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = _Meta.Builder::class) - @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The current page. */ - fun page(): Long = page.getRequired("page") - - /** The number of items per page. */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** The total number of items. */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** The total number of pages. */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page - - /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage - - /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems - - /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): _Meta = apply { - if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var page: JsonField = JsonMissing.of() - private var perPage: JsonField = JsonMissing.of() - private var totalItems: JsonField = JsonMissing.of() - private var totalPages: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - this.page = _meta.page - this.perPage = _meta.perPage - this.totalItems = _meta.totalItems - this.totalPages = _meta.totalPages - additionalProperties(_meta.additionalProperties) - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - 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(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) - } - } - - @JsonDeserialize(builder = Item.Builder::class) - @NoAutoDetect - class Item - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** 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 start date. */ - fun dateDataStarts(): Optional = - Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) - - /** The data end date. */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) - - /** The status of the test. */ - fun status(): Status = status.getRequired("status") - - /** The status message. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) - - /** Project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - @JsonProperty("goal") @ExcludeMissing fun _goal() = goal - - /** The test id. */ - @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId - - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId - - /** The inference pipeline id. */ - @JsonProperty("inferencePipelineId") - @ExcludeMissing - fun _inferencePipelineId() = inferencePipelineId - - /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The data start date. */ - @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts - - /** The data end date. */ - @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds - - /** The status of the test. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - /** The status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Item = apply { - if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - 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) - } - - /** 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 test id. */ - fun goalId(goalId: String) = goalId(JsonField.of(goalId)) - - /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun goalId(goalId: JsonField) = apply { this.goalId = goalId } - - /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = - projectVersionId(JsonField.of(projectVersionId)) - - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun projectVersionId(projectVersionId: JsonField) = apply { - this.projectVersionId = projectVersionId - } - - /** 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 creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } - - /** 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 data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun dateDataStarts(dateDataStarts: JsonField) = apply { - this.dateDataStarts = dateDataStarts - } - - /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = - dateDataEnds(JsonField.of(dateDataEnds)) - - /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun dateDataEnds(dateDataEnds: JsonField) = apply { - this.dateDataEnds = dateDataEnds - } - - /** 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)) - - /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - 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(): Item = - Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PASSING = Status(JsonField.of("passing")) - - @JvmField val FAILING = Status(JsonField.of("failing")) - - @JvmField val SKIPPED = Status(JsonField.of("skipped")) - - @JvmField val ERROR = Status(JsonField.of("error")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - } - - enum class Value { - RUNNING, - PASSING, - FAILING, - SKIPPED, - ERROR, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = Goal.Builder::class) - @NoAutoDetect - class Goal - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The test id. */ - fun id(): String = id.getRequired("id") - - /** The test number. */ - fun number(): Long = number.getRequired("number") - - /** The test 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 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 subtype. */ - fun subtype(): String = subtype.getRequired("subtype") - - /** The test creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) - - /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(): Optional = - Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) - - fun thresholds(): List = thresholds.getRequired("thresholds") - - /** 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 number of comments on the test. */ - fun commentCount(): Long = commentCount.getRequired("commentCount") - - /** 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 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")) - - /** The test id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The test number. */ - @JsonProperty("number") @ExcludeMissing fun _number() = number - - /** The test name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = 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") - @ExcludeMissing - fun _evaluationWindow() = evaluationWindow - - /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow - - /** The test type. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type - - /** The test subtype. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype - - /** The test creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") - @ExcludeMissing - fun _originProjectVersionId() = originProjectVersionId - - @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds - - /** Whether the test is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = 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 number of comments on the test. */ - @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount - - /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel - - /** Whether the test uses a validation dataset. */ - @JsonProperty("usesValidationDataset") - @ExcludeMissing - fun _usesValidationDataset() = usesValidationDataset - - /** Whether the test uses a training dataset. */ - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - fun _usesTrainingDataset() = usesTrainingDataset - - /** Whether the test uses a reference dataset (monitoring mode only). */ - @JsonProperty("usesReferenceDataset") - @ExcludeMissing - fun _usesReferenceDataset() = usesReferenceDataset - - /** Whether the test uses production data (monitoring mode only). */ - @JsonProperty("usesProductionData") - @ExcludeMissing - fun _usesProductionData() = usesProductionData - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - 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 - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - 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, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - 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 archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var suggested: JsonField = JsonMissing.of() - private var commentCount: 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 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) - } - - /** 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 test number. */ - @JsonProperty("number") - @ExcludeMissing - fun number(number: JsonField) = apply { this.number = number } - - /** The test name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - - /** 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 - } - - /** 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 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 evaluation window in seconds. Only applies to tests that use production data. - */ - @JsonProperty("evaluationWindow") - @ExcludeMissing - fun evaluationWindow(evaluationWindow: JsonField) = apply { - this.evaluationWindow = evaluationWindow - } - - /** The delay window in seconds. Only applies to tests that use production data. */ - fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) - - /** 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 type. */ - fun type(type: String) = type(JsonField.of(type)) - - /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - /** 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)) - - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") - @ExcludeMissing - fun originProjectVersionId(originProjectVersionId: JsonField) = apply { - this.originProjectVersionId = originProjectVersionId - } - - fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) - - @JsonProperty("thresholds") - @ExcludeMissing - fun thresholds(thresholds: JsonField>) = apply { - this.thresholds = thresholds - } - - /** 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 date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived - } - - /** Whether the test is suggested or user-created. */ - fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) - - /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun suggested(suggested: JsonField) = apply { this.suggested = suggested } - - /** The number of comments on the test. */ - fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) - - /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun commentCount(commentCount: JsonField) = apply { - this.commentCount = commentCount - } - - /** 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 a training dataset. */ - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { - this.usesTrainingDataset = usesTrainingDataset - } - - /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = - 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 production data (monitoring mode only). */ - @JsonProperty("usesProductionData") - @ExcludeMissing - fun usesProductionData(usesProductionData: JsonField) = apply { - this.usesProductionData = usesProductionData - } - - 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(): Goal = - Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = Threshold.Builder::class) - @NoAutoDetect - class Threshold - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** 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")) - - fun insightParameters(): Optional> = - Optional.ofNullable(insightParameters.getNullable("insightParameters")) - - /** The operator to be used for the evaluation. */ - fun operator(): Optional = - Optional.ofNullable(operator.getNullable("operator")) - - /** 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("insightParameters") - @ExcludeMissing - fun _insightParameters() = insightParameters - - /** The operator to be used for the evaluation. */ - @JsonProperty("operator") @ExcludeMissing fun _operator() = operator - - /** The value to be compared. */ - @JsonProperty("value") @ExcludeMissing fun _value() = value - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Threshold = apply { - if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var measurement: JsonField = JsonMissing.of() - private var insightName: JsonField = JsonMissing.of() - private var insightParameters: 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 - } - - /** 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 - } - - fun insightParameters(insightParameters: List) = - insightParameters(JsonField.of(insightParameters)) - - @JsonProperty("insightParameters") - @ExcludeMissing - fun insightParameters(insightParameters: JsonField>) = apply { - this.insightParameters = insightParameters - } - - /** 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 } - - 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(): Threshold = - Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, - private val string: String? = null, - private val strings: List? = null, - private val _json: JsonValue? = null, - ) { - - private var validated: Boolean = false - - fun double(): Optional = Optional.ofNullable(double) - - fun boolean(): Optional = Optional.ofNullable(boolean) - - fun string(): Optional = Optional.ofNullable(string) - - fun strings(): Optional> = Optional.ofNullable(strings) - - fun isDouble(): Boolean = double != null - - fun isBoolean(): Boolean = boolean != null - - fun isString(): Boolean = string != null - - fun isStrings(): Boolean = strings != null - - fun asDouble(): Double = double.getOrThrow("double") - - fun asBoolean(): Boolean = boolean.getOrThrow("boolean") - - fun asString(): String = string.getOrThrow("string") - - fun asStrings(): List = strings.getOrThrow("strings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T { - return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) - string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - else -> visitor.unknown(_json) - } - } - - fun validate(): Value = apply { - if (!validated) { - if ( - double == null && - boolean == null && - string == null && - strings == null - ) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings - } - - override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) - } - - override fun toString(): String { - return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" - string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - } - - companion object { - - @JvmStatic fun ofDouble(double: Double) = Value(double = double) - - @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - - @JvmStatic fun ofString(string: String) = Value(string = string) - - @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) - } - - interface Visitor { - - fun visitDouble(double: Double): T - - fun visitBoolean(boolean: Boolean): T - - fun visitString(string: String): T - - fun visitStrings(strings: List): T - - fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") - } - } - - class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) - } - } - - class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider - ) { - when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) - 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") - } - } - } - } - } - } - } -} 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 deleted file mode 100644 index 6951d52..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ /dev/null @@ -1,179 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional - -class ProjectCommitListParams -constructor( - private val id: String, - private val page: Long?, - private val perPage: Long?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun id(): String = id - - fun page(): Optional = Optional.ofNullable(page) - - fun perPage(): Optional = Optional.ofNullable(perPage) - - @JvmSynthetic - internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() - } - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> id - else -> "" - } - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListParams && - this.id == other.id && - this.page == other.page && - this.perPage == other.perPage && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int { - return Objects.hash( - id, - page, - perPage, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) - } - - override fun toString() = - "ProjectCommitListParams{id=$id, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var id: String? = null - private var page: Long? = null - private var perPage: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(projectCommitListParams: ProjectCommitListParams) = apply { - this.id = projectCommitListParams.id - this.page = projectCommitListParams.page - this.perPage = projectCommitListParams.perPage - additionalQueryParams(projectCommitListParams.additionalQueryParams) - additionalHeaders(projectCommitListParams.additionalHeaders) - additionalBodyProperties(projectCommitListParams.additionalBodyProperties) - } - - fun id(id: String) = apply { this.id = id } - - /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } - - /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) - } - - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) - } - - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) - } - - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) - } - - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) - } - - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } - - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - this.additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectCommitListParams = - ProjectCommitListParams( - checkNotNull(id) { "`id` is required but was not set" }, - page, - perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } -} 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 deleted file mode 100644 index da9d1fd..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ /dev/null @@ -1,1308 +0,0 @@ -// 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.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.toUnmodifiable -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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun _meta(): _Meta = _meta.getRequired("_meta") - - fun items(): List = items.getRequired("items") - - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - - @JsonProperty("items") @ExcludeMissing fun _items() = items - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): ProjectCommitListResponse = apply { - if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var _meta: JsonField<_Meta> = JsonMissing.of() - private var items: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(projectCommitListResponse: ProjectCommitListResponse) = apply { - this._meta = projectCommitListResponse._meta - this.items = projectCommitListResponse.items - additionalProperties(projectCommitListResponse.additionalProperties) - } - - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - @JsonProperty("_meta") - @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - - fun items(items: List) = items(JsonField.of(items)) - - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } - - 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(): ProjectCommitListResponse = - ProjectCommitListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) - } - - @JsonDeserialize(builder = _Meta.Builder::class) - @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The current page. */ - fun page(): Long = page.getRequired("page") - - /** The number of items per page. */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** The total number of items. */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** The total number of pages. */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page - - /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage - - /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems - - /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): _Meta = apply { - if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var page: JsonField = JsonMissing.of() - private var perPage: JsonField = JsonMissing.of() - private var totalItems: JsonField = JsonMissing.of() - private var totalPages: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - this.page = _meta.page - this.perPage = _meta.perPage - this.totalItems = _meta.totalItems - this.totalPages = _meta.totalPages - additionalProperties(_meta.additionalProperties) - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - 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(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) - } - } - - @JsonDeserialize(builder = Item.Builder::class) - @NoAutoDetect - class Item - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** The project version (commit) id. */ - fun id(): String = id.getRequired("id") - - /** The project version (commit) creation date. */ - fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - - /** - * 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 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 model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - - /** 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 commit archive date. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) - - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - - /** 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") - - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) - - /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** - * 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 - - /** The commit status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - - /** 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 - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun _validationDatasetId() = validationDatasetId - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun _trainingDatasetId() = trainingDatasetId - - /** 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 - - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount - - @JsonProperty("links") @ExcludeMissing fun _links() = links - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - 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 - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.dateCreated == other.dateCreated && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.projectId == other.projectId && - this.storageUri == other.storageUri && - this.commit == other.commit && - this.deploymentStatus == other.deploymentStatus && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - 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 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 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) - } - - /** 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 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 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`. - */ - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } - - /** The commit status message. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) - - /** 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 details of a commit (project version). */ - @JsonProperty("commit") - @ExcludeMissing - fun commit(commit: JsonField) = apply { this.commit = commit } - - /** 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") - @ExcludeMissing - fun deploymentStatus(deploymentStatus: JsonField) = apply { - this.deploymentStatus = deploymentStatus - } - - /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) - - /** 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 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)) - - /** 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(JsonField.of(archived)) - - /** 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 total number of tests for the commit. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Item = - Item( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties.toUnmodifiable(), - ) - } - - /** The details of a commit (project version). */ - @JsonDeserialize(builder = Commit.Builder::class) - @NoAutoDetect - class Commit - 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, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - /** 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")) - - /** The commit message. */ - fun message(): String = message.getRequired("message") - - /** The model id. */ - fun mlModelId(): Optional = - Optional.ofNullable(mlModelId.getNullable("mlModelId")) - - /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - - /** 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 SHA of the corresponding git commit. */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) - - /** The ref of the corresponding git commit. */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) - - /** The URL of the corresponding git commit. */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) - - /** The commit id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The author id of the commit. */ - @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId - - /** The commit creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize - - /** The commit message. */ - @JsonProperty("message") @ExcludeMissing fun _message() = message - - /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun _validationDatasetId() = validationDatasetId - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun _trainingDatasetId() = trainingDatasetId - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri - - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha - - /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef - - /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Commit = apply { - if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Commit && - this.id == other.id && - this.authorId == other.authorId && - this.dateCreated == other.dateCreated && - this.fileSize == other.fileSize && - this.message == other.message && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.storageUri == other.storageUri && - this.gitCommitSha == other.gitCommitSha && - this.gitCommitRef == other.gitCommitRef && - this.gitCommitUrl == other.gitCommitUrl && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties, - ) - } - return 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}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - private var authorId: JsonField = JsonMissing.of() - 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 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) - } - - /** 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 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(JsonField.of(fileSize)) - - /** 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)) - - /** 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 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)) - - /** 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 storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { - this.storageUri = storageUri - } - - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - @ExcludeMissing - fun gitCommitSha(gitCommitSha: JsonField) = apply { - this.gitCommitSha = gitCommitSha - } - - /** 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 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Commit = - Commit( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties.toUnmodifiable(), - ) - } - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val QUEUED = Status(JsonField.of("queued")) - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PAUSED = Status(JsonField.of("paused")) - - @JvmField val FAILED = Status(JsonField.of("failed")) - - @JvmField val COMPLETED = Status(JsonField.of("completed")) - - @JvmField val UNKNOWN = Status(JsonField.of("unknown")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - } - - enum class Value { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - _UNKNOWN, - } - - 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 - } - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = Links.Builder::class) - @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun app(): String = app.getRequired("app") - - @JsonProperty("app") @ExcludeMissing fun _app() = app - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Links = apply { - if (!validated) { - app() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var app: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) - } - - 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) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) - } - } - } -} 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 7feaef8..dab084a 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 @@ -25,9 +25,6 @@ constructor( private val taskType: TaskType, private val description: String?, private val gitRepo: GitRepo?, - private val slackChannelId: String?, - private val slackChannelName: String?, - private val slackChannelNotificationsEnabled: Boolean?, private val additionalQueryParams: Map>, private val additionalHeaders: Map>, private val additionalBodyProperties: Map, @@ -41,13 +38,6 @@ constructor( fun gitRepo(): Optional = Optional.ofNullable(gitRepo) - fun slackChannelId(): Optional = Optional.ofNullable(slackChannelId) - - fun slackChannelName(): Optional = Optional.ofNullable(slackChannelName) - - fun slackChannelNotificationsEnabled(): Optional = - Optional.ofNullable(slackChannelNotificationsEnabled) - @JvmSynthetic internal fun getBody(): ProjectCreateBody { return ProjectCreateBody( @@ -55,9 +45,6 @@ constructor( taskType, description, gitRepo, - slackChannelId, - slackChannelName, - slackChannelNotificationsEnabled, additionalBodyProperties, ) } @@ -74,9 +61,6 @@ constructor( private val taskType: TaskType?, private val description: String?, private val gitRepo: GitRepo?, - private val slackChannelId: String?, - private val slackChannelName: String?, - private val slackChannelNotificationsEnabled: Boolean?, private val additionalProperties: Map, ) { @@ -93,16 +77,6 @@ constructor( @JsonProperty("gitRepo") fun gitRepo(): GitRepo? = gitRepo - /** The slack channel id connected to the project. */ - @JsonProperty("slackChannelId") fun slackChannelId(): String? = slackChannelId - - /** The slack channel connected to the project. */ - @JsonProperty("slackChannelName") fun slackChannelName(): String? = slackChannelName - - /** Whether slack channel notifications are enabled for the project. */ - @JsonProperty("slackChannelNotificationsEnabled") - fun slackChannelNotificationsEnabled(): Boolean? = slackChannelNotificationsEnabled - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -119,9 +93,6 @@ constructor( this.taskType == other.taskType && this.description == other.description && this.gitRepo == other.gitRepo && - this.slackChannelId == other.slackChannelId && - this.slackChannelName == other.slackChannelName && - this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && this.additionalProperties == other.additionalProperties } @@ -133,9 +104,6 @@ constructor( taskType, description, gitRepo, - slackChannelId, - slackChannelName, - slackChannelNotificationsEnabled, additionalProperties, ) } @@ -143,7 +111,7 @@ constructor( } override fun toString() = - "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, slackChannelId=$slackChannelId, slackChannelName=$slackChannelName, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, additionalProperties=$additionalProperties}" + "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" companion object { @@ -156,9 +124,6 @@ constructor( private var taskType: TaskType? = null private var description: String? = null private var gitRepo: GitRepo? = null - private var slackChannelId: String? = null - private var slackChannelName: String? = null - private var slackChannelNotificationsEnabled: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -167,10 +132,6 @@ constructor( this.taskType = projectCreateBody.taskType this.description = projectCreateBody.description this.gitRepo = projectCreateBody.gitRepo - this.slackChannelId = projectCreateBody.slackChannelId - this.slackChannelName = projectCreateBody.slackChannelName - this.slackChannelNotificationsEnabled = - projectCreateBody.slackChannelNotificationsEnabled additionalProperties(projectCreateBody.additionalProperties) } @@ -188,25 +149,6 @@ constructor( @JsonProperty("gitRepo") fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } - /** The slack channel id connected to the project. */ - @JsonProperty("slackChannelId") - fun slackChannelId(slackChannelId: String) = apply { - this.slackChannelId = slackChannelId - } - - /** The slack channel connected to the project. */ - @JsonProperty("slackChannelName") - fun slackChannelName(slackChannelName: String) = apply { - this.slackChannelName = slackChannelName - } - - /** Whether slack channel notifications are enabled for the project. */ - @JsonProperty("slackChannelNotificationsEnabled") - fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = - apply { - this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() this.additionalProperties.putAll(additionalProperties) @@ -227,9 +169,6 @@ constructor( checkNotNull(taskType) { "`taskType` is required but was not set" }, description, gitRepo, - slackChannelId, - slackChannelName, - slackChannelNotificationsEnabled, additionalProperties.toUnmodifiable(), ) } @@ -251,9 +190,6 @@ constructor( this.taskType == other.taskType && this.description == other.description && this.gitRepo == other.gitRepo && - this.slackChannelId == other.slackChannelId && - this.slackChannelName == other.slackChannelName && - this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties @@ -265,9 +201,6 @@ constructor( taskType, description, gitRepo, - slackChannelId, - slackChannelName, - slackChannelNotificationsEnabled, additionalQueryParams, additionalHeaders, additionalBodyProperties, @@ -275,7 +208,7 @@ constructor( } override fun toString() = - "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, slackChannelId=$slackChannelId, slackChannelName=$slackChannelName, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -291,9 +224,6 @@ constructor( private var taskType: TaskType? = null private var description: String? = null private var gitRepo: GitRepo? = null - private var slackChannelId: String? = null - private var slackChannelName: String? = null - private var slackChannelNotificationsEnabled: Boolean? = null private var additionalQueryParams: MutableMap> = mutableMapOf() private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() @@ -304,10 +234,6 @@ constructor( this.taskType = projectCreateParams.taskType this.description = projectCreateParams.description this.gitRepo = projectCreateParams.gitRepo - this.slackChannelId = projectCreateParams.slackChannelId - this.slackChannelName = projectCreateParams.slackChannelName - this.slackChannelNotificationsEnabled = - projectCreateParams.slackChannelNotificationsEnabled additionalQueryParams(projectCreateParams.additionalQueryParams) additionalHeaders(projectCreateParams.additionalHeaders) additionalBodyProperties(projectCreateParams.additionalBodyProperties) @@ -324,19 +250,6 @@ constructor( fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } - /** The slack channel id connected to the project. */ - fun slackChannelId(slackChannelId: String) = apply { this.slackChannelId = slackChannelId } - - /** The slack channel connected to the project. */ - fun slackChannelName(slackChannelName: String) = apply { - this.slackChannelName = slackChannelName - } - - /** Whether slack channel notifications are enabled for the project. */ - fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = apply { - this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled - } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() putAllQueryParams(additionalQueryParams) @@ -397,9 +310,6 @@ constructor( checkNotNull(taskType) { "`taskType` is required but was not set" }, description, gitRepo, - slackChannelId, - slackChannelName, - slackChannelNotificationsEnabled, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalBodyProperties.toUnmodifiable(), 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 fdbee3e..eb6afee 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 @@ -30,7 +30,6 @@ private constructor( private val dateCreated: JsonField, private val dateUpdated: JsonField, private val description: JsonField, - private val sample: JsonField, private val source: JsonField, private val taskType: JsonField, private val versionCount: JsonField, @@ -38,11 +37,7 @@ private constructor( private val goalCount: JsonField, private val developmentGoalCount: JsonField, private val monitoringGoalCount: JsonField, - private val unreadNotificationCount: JsonField, private val links: JsonField, - private val slackChannelNotificationsEnabled: JsonField, - private val slackChannelName: JsonField, - private val slackChannelId: JsonField, private val gitRepo: JsonField, private val additionalProperties: Map, ) { @@ -74,9 +69,6 @@ private constructor( fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Whether the project is a sample project or a user-created project. */ - fun sample(): Boolean = sample.getRequired("sample") - /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -99,27 +91,9 @@ private constructor( /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The number of unread notifications in the project. */ - fun unreadNotificationCount(): Optional = - Optional.ofNullable(unreadNotificationCount.getNullable("unreadNotificationCount")) - /** Links to the project. */ fun links(): Links = links.getRequired("links") - /** Whether slack channel notifications are enabled for the project. */ - fun slackChannelNotificationsEnabled(): Optional = - Optional.ofNullable( - slackChannelNotificationsEnabled.getNullable("slackChannelNotificationsEnabled") - ) - - /** The slack channel connected to the project. */ - fun slackChannelName(): Optional = - Optional.ofNullable(slackChannelName.getNullable("slackChannelName")) - - /** The slack channel id connected to the project. */ - fun slackChannelId(): Optional = - Optional.ofNullable(slackChannelId.getNullable("slackChannelId")) - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ @@ -143,9 +117,6 @@ private constructor( /** The project description. */ @JsonProperty("description") @ExcludeMissing fun _description() = description - /** Whether the project is a sample project or a user-created project. */ - @JsonProperty("sample") @ExcludeMissing fun _sample() = sample - /** The source of the project. */ @JsonProperty("source") @ExcludeMissing fun _source() = source @@ -173,25 +144,9 @@ private constructor( @ExcludeMissing fun _monitoringGoalCount() = monitoringGoalCount - /** The number of unread notifications in the project. */ - @JsonProperty("unreadNotificationCount") - @ExcludeMissing - fun _unreadNotificationCount() = unreadNotificationCount - /** Links to the project. */ @JsonProperty("links") @ExcludeMissing fun _links() = links - /** Whether slack channel notifications are enabled for the project. */ - @JsonProperty("slackChannelNotificationsEnabled") - @ExcludeMissing - fun _slackChannelNotificationsEnabled() = slackChannelNotificationsEnabled - - /** The slack channel connected to the project. */ - @JsonProperty("slackChannelName") @ExcludeMissing fun _slackChannelName() = slackChannelName - - /** The slack channel id connected to the project. */ - @JsonProperty("slackChannelId") @ExcludeMissing fun _slackChannelId() = slackChannelId - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo @JsonAnyGetter @@ -207,7 +162,6 @@ private constructor( dateCreated() dateUpdated() description() - sample() source() taskType() versionCount() @@ -215,11 +169,7 @@ private constructor( goalCount() developmentGoalCount() monitoringGoalCount() - unreadNotificationCount() links().validate() - slackChannelNotificationsEnabled() - slackChannelName() - slackChannelId() gitRepo().map { it.validate() } validated = true } @@ -240,7 +190,6 @@ private constructor( this.dateCreated == other.dateCreated && this.dateUpdated == other.dateUpdated && this.description == other.description && - this.sample == other.sample && this.source == other.source && this.taskType == other.taskType && this.versionCount == other.versionCount && @@ -248,11 +197,7 @@ private constructor( this.goalCount == other.goalCount && this.developmentGoalCount == other.developmentGoalCount && this.monitoringGoalCount == other.monitoringGoalCount && - this.unreadNotificationCount == other.unreadNotificationCount && this.links == other.links && - this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && - this.slackChannelName == other.slackChannelName && - this.slackChannelId == other.slackChannelId && this.gitRepo == other.gitRepo && this.additionalProperties == other.additionalProperties } @@ -268,7 +213,6 @@ private constructor( dateCreated, dateUpdated, description, - sample, source, taskType, versionCount, @@ -276,11 +220,7 @@ private constructor( goalCount, developmentGoalCount, monitoringGoalCount, - unreadNotificationCount, links, - slackChannelNotificationsEnabled, - slackChannelName, - slackChannelId, gitRepo, additionalProperties, ) @@ -289,7 +229,7 @@ private constructor( } override fun toString() = - "ProjectCreateResponse{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, sample=$sample, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, unreadNotificationCount=$unreadNotificationCount, links=$links, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, slackChannelName=$slackChannelName, slackChannelId=$slackChannelId, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "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}" companion object { @@ -305,7 +245,6 @@ private constructor( private var dateCreated: JsonField = JsonMissing.of() private var dateUpdated: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() - private var sample: JsonField = JsonMissing.of() private var source: JsonField = JsonMissing.of() private var taskType: JsonField = JsonMissing.of() private var versionCount: JsonField = JsonMissing.of() @@ -313,11 +252,7 @@ private constructor( private var goalCount: JsonField = JsonMissing.of() private var developmentGoalCount: JsonField = JsonMissing.of() private var monitoringGoalCount: JsonField = JsonMissing.of() - private var unreadNotificationCount: JsonField = JsonMissing.of() private var links: JsonField = JsonMissing.of() - private var slackChannelNotificationsEnabled: JsonField = JsonMissing.of() - private var slackChannelName: JsonField = JsonMissing.of() - private var slackChannelId: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -330,7 +265,6 @@ private constructor( this.dateCreated = projectCreateResponse.dateCreated this.dateUpdated = projectCreateResponse.dateUpdated this.description = projectCreateResponse.description - this.sample = projectCreateResponse.sample this.source = projectCreateResponse.source this.taskType = projectCreateResponse.taskType this.versionCount = projectCreateResponse.versionCount @@ -338,12 +272,7 @@ private constructor( this.goalCount = projectCreateResponse.goalCount this.developmentGoalCount = projectCreateResponse.developmentGoalCount this.monitoringGoalCount = projectCreateResponse.monitoringGoalCount - this.unreadNotificationCount = projectCreateResponse.unreadNotificationCount this.links = projectCreateResponse.links - this.slackChannelNotificationsEnabled = - projectCreateResponse.slackChannelNotificationsEnabled - this.slackChannelName = projectCreateResponse.slackChannelName - this.slackChannelId = projectCreateResponse.slackChannelId this.gitRepo = projectCreateResponse.gitRepo additionalProperties(projectCreateResponse.additionalProperties) } @@ -406,14 +335,6 @@ private constructor( @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } - /** Whether the project is a sample project or a user-created project. */ - fun sample(sample: Boolean) = sample(JsonField.of(sample)) - - /** Whether the project is a sample project or a user-created project. */ - @JsonProperty("sample") - @ExcludeMissing - fun sample(sample: JsonField) = apply { this.sample = sample } - /** The source of the project. */ fun source(source: Source) = source(JsonField.of(source)) @@ -479,17 +400,6 @@ private constructor( this.monitoringGoalCount = monitoringGoalCount } - /** The number of unread notifications in the project. */ - fun unreadNotificationCount(unreadNotificationCount: Long) = - unreadNotificationCount(JsonField.of(unreadNotificationCount)) - - /** The number of unread notifications in the project. */ - @JsonProperty("unreadNotificationCount") - @ExcludeMissing - fun unreadNotificationCount(unreadNotificationCount: JsonField) = apply { - this.unreadNotificationCount = unreadNotificationCount - } - /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) @@ -498,39 +408,6 @@ private constructor( @ExcludeMissing fun links(links: JsonField) = apply { this.links = links } - /** Whether slack channel notifications are enabled for the project. */ - fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = - slackChannelNotificationsEnabled(JsonField.of(slackChannelNotificationsEnabled)) - - /** Whether slack channel notifications are enabled for the project. */ - @JsonProperty("slackChannelNotificationsEnabled") - @ExcludeMissing - fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: JsonField) = - apply { - this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled - } - - /** The slack channel connected to the project. */ - fun slackChannelName(slackChannelName: String) = - slackChannelName(JsonField.of(slackChannelName)) - - /** The slack channel connected to the project. */ - @JsonProperty("slackChannelName") - @ExcludeMissing - fun slackChannelName(slackChannelName: JsonField) = apply { - this.slackChannelName = slackChannelName - } - - /** The slack channel id connected to the project. */ - fun slackChannelId(slackChannelId: String) = slackChannelId(JsonField.of(slackChannelId)) - - /** The slack channel id connected to the project. */ - @JsonProperty("slackChannelId") - @ExcludeMissing - fun slackChannelId(slackChannelId: JsonField) = apply { - this.slackChannelId = slackChannelId - } - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @@ -560,7 +437,6 @@ private constructor( dateCreated, dateUpdated, description, - sample, source, taskType, versionCount, @@ -568,11 +444,7 @@ private constructor( goalCount, developmentGoalCount, monitoringGoalCount, - unreadNotificationCount, links, - slackChannelNotificationsEnabled, - slackChannelName, - slackChannelId, gitRepo, additionalProperties.toUnmodifiable(), ) 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 025b285..69c6387 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 @@ -307,7 +307,6 @@ private constructor( private val dateCreated: JsonField, private val dateUpdated: JsonField, private val description: JsonField, - private val sample: JsonField, private val source: JsonField, private val taskType: JsonField, private val versionCount: JsonField, @@ -315,11 +314,7 @@ private constructor( private val goalCount: JsonField, private val developmentGoalCount: JsonField, private val monitoringGoalCount: JsonField, - private val unreadNotificationCount: JsonField, private val links: JsonField, - private val slackChannelNotificationsEnabled: JsonField, - private val slackChannelName: JsonField, - private val slackChannelId: JsonField, private val gitRepo: JsonField, private val additionalProperties: Map, ) { @@ -351,9 +346,6 @@ private constructor( fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Whether the project is a sample project or a user-created project. */ - fun sample(): Boolean = sample.getRequired("sample") - /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -376,27 +368,9 @@ private constructor( /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The number of unread notifications in the project. */ - fun unreadNotificationCount(): Optional = - Optional.ofNullable(unreadNotificationCount.getNullable("unreadNotificationCount")) - /** Links to the project. */ fun links(): Links = links.getRequired("links") - /** Whether slack channel notifications are enabled for the project. */ - fun slackChannelNotificationsEnabled(): Optional = - Optional.ofNullable( - slackChannelNotificationsEnabled.getNullable("slackChannelNotificationsEnabled") - ) - - /** The slack channel connected to the project. */ - fun slackChannelName(): Optional = - Optional.ofNullable(slackChannelName.getNullable("slackChannelName")) - - /** The slack channel id connected to the project. */ - fun slackChannelId(): Optional = - Optional.ofNullable(slackChannelId.getNullable("slackChannelId")) - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ @@ -420,9 +394,6 @@ private constructor( /** The project description. */ @JsonProperty("description") @ExcludeMissing fun _description() = description - /** Whether the project is a sample project or a user-created project. */ - @JsonProperty("sample") @ExcludeMissing fun _sample() = sample - /** The source of the project. */ @JsonProperty("source") @ExcludeMissing fun _source() = source @@ -450,25 +421,9 @@ private constructor( @ExcludeMissing fun _monitoringGoalCount() = monitoringGoalCount - /** The number of unread notifications in the project. */ - @JsonProperty("unreadNotificationCount") - @ExcludeMissing - fun _unreadNotificationCount() = unreadNotificationCount - /** Links to the project. */ @JsonProperty("links") @ExcludeMissing fun _links() = links - /** Whether slack channel notifications are enabled for the project. */ - @JsonProperty("slackChannelNotificationsEnabled") - @ExcludeMissing - fun _slackChannelNotificationsEnabled() = slackChannelNotificationsEnabled - - /** The slack channel connected to the project. */ - @JsonProperty("slackChannelName") @ExcludeMissing fun _slackChannelName() = slackChannelName - - /** The slack channel id connected to the project. */ - @JsonProperty("slackChannelId") @ExcludeMissing fun _slackChannelId() = slackChannelId - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo @JsonAnyGetter @@ -484,7 +439,6 @@ private constructor( dateCreated() dateUpdated() description() - sample() source() taskType() versionCount() @@ -492,11 +446,7 @@ private constructor( goalCount() developmentGoalCount() monitoringGoalCount() - unreadNotificationCount() links().validate() - slackChannelNotificationsEnabled() - slackChannelName() - slackChannelId() gitRepo().map { it.validate() } validated = true } @@ -517,7 +467,6 @@ private constructor( this.dateCreated == other.dateCreated && this.dateUpdated == other.dateUpdated && this.description == other.description && - this.sample == other.sample && this.source == other.source && this.taskType == other.taskType && this.versionCount == other.versionCount && @@ -525,11 +474,7 @@ private constructor( this.goalCount == other.goalCount && this.developmentGoalCount == other.developmentGoalCount && this.monitoringGoalCount == other.monitoringGoalCount && - this.unreadNotificationCount == other.unreadNotificationCount && this.links == other.links && - this.slackChannelNotificationsEnabled == other.slackChannelNotificationsEnabled && - this.slackChannelName == other.slackChannelName && - this.slackChannelId == other.slackChannelId && this.gitRepo == other.gitRepo && this.additionalProperties == other.additionalProperties } @@ -545,7 +490,6 @@ private constructor( dateCreated, dateUpdated, description, - sample, source, taskType, versionCount, @@ -553,11 +497,7 @@ private constructor( goalCount, developmentGoalCount, monitoringGoalCount, - unreadNotificationCount, links, - slackChannelNotificationsEnabled, - slackChannelName, - slackChannelId, gitRepo, additionalProperties, ) @@ -566,7 +506,7 @@ private constructor( } override fun toString() = - "Item{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, sample=$sample, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, unreadNotificationCount=$unreadNotificationCount, links=$links, slackChannelNotificationsEnabled=$slackChannelNotificationsEnabled, slackChannelName=$slackChannelName, slackChannelId=$slackChannelId, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "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}" companion object { @@ -582,7 +522,6 @@ private constructor( private var dateCreated: JsonField = JsonMissing.of() private var dateUpdated: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() - private var sample: JsonField = JsonMissing.of() private var source: JsonField = JsonMissing.of() private var taskType: JsonField = JsonMissing.of() private var versionCount: JsonField = JsonMissing.of() @@ -590,11 +529,7 @@ private constructor( private var goalCount: JsonField = JsonMissing.of() private var developmentGoalCount: JsonField = JsonMissing.of() private var monitoringGoalCount: JsonField = JsonMissing.of() - private var unreadNotificationCount: JsonField = JsonMissing.of() private var links: JsonField = JsonMissing.of() - private var slackChannelNotificationsEnabled: JsonField = JsonMissing.of() - private var slackChannelName: JsonField = JsonMissing.of() - private var slackChannelId: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -607,7 +542,6 @@ private constructor( this.dateCreated = item.dateCreated this.dateUpdated = item.dateUpdated this.description = item.description - this.sample = item.sample this.source = item.source this.taskType = item.taskType this.versionCount = item.versionCount @@ -615,11 +549,7 @@ private constructor( this.goalCount = item.goalCount this.developmentGoalCount = item.developmentGoalCount this.monitoringGoalCount = item.monitoringGoalCount - this.unreadNotificationCount = item.unreadNotificationCount this.links = item.links - this.slackChannelNotificationsEnabled = item.slackChannelNotificationsEnabled - this.slackChannelName = item.slackChannelName - this.slackChannelId = item.slackChannelId this.gitRepo = item.gitRepo additionalProperties(item.additionalProperties) } @@ -688,14 +618,6 @@ private constructor( this.description = description } - /** Whether the project is a sample project or a user-created project. */ - fun sample(sample: Boolean) = sample(JsonField.of(sample)) - - /** Whether the project is a sample project or a user-created project. */ - @JsonProperty("sample") - @ExcludeMissing - fun sample(sample: JsonField) = apply { this.sample = sample } - /** The source of the project. */ fun source(source: Source) = source(JsonField.of(source)) @@ -763,17 +685,6 @@ private constructor( this.monitoringGoalCount = monitoringGoalCount } - /** The number of unread notifications in the project. */ - fun unreadNotificationCount(unreadNotificationCount: Long) = - unreadNotificationCount(JsonField.of(unreadNotificationCount)) - - /** The number of unread notifications in the project. */ - @JsonProperty("unreadNotificationCount") - @ExcludeMissing - fun unreadNotificationCount(unreadNotificationCount: JsonField) = apply { - this.unreadNotificationCount = unreadNotificationCount - } - /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) @@ -782,39 +693,6 @@ private constructor( @ExcludeMissing fun links(links: JsonField) = apply { this.links = links } - /** Whether slack channel notifications are enabled for the project. */ - fun slackChannelNotificationsEnabled(slackChannelNotificationsEnabled: Boolean) = - slackChannelNotificationsEnabled(JsonField.of(slackChannelNotificationsEnabled)) - - /** Whether slack channel notifications are enabled for the project. */ - @JsonProperty("slackChannelNotificationsEnabled") - @ExcludeMissing - fun slackChannelNotificationsEnabled( - slackChannelNotificationsEnabled: JsonField - ) = apply { this.slackChannelNotificationsEnabled = slackChannelNotificationsEnabled } - - /** The slack channel connected to the project. */ - fun slackChannelName(slackChannelName: String) = - slackChannelName(JsonField.of(slackChannelName)) - - /** The slack channel connected to the project. */ - @JsonProperty("slackChannelName") - @ExcludeMissing - fun slackChannelName(slackChannelName: JsonField) = apply { - this.slackChannelName = slackChannelName - } - - /** The slack channel id connected to the project. */ - fun slackChannelId(slackChannelId: String) = - slackChannelId(JsonField.of(slackChannelId)) - - /** The slack channel id connected to the project. */ - @JsonProperty("slackChannelId") - @ExcludeMissing - fun slackChannelId(slackChannelId: JsonField) = apply { - this.slackChannelId = slackChannelId - } - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @@ -844,7 +722,6 @@ private constructor( dateCreated, dateUpdated, description, - sample, source, taskType, versionCount, @@ -852,11 +729,7 @@ private constructor( goalCount, developmentGoalCount, monitoringGoalCount, - unreadNotificationCount, links, - slackChannelNotificationsEnabled, - slackChannelName, - slackChannelId, gitRepo, additionalProperties.toUnmodifiable(), ) 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 cbf79aa..1eaf12d 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 @@ -4,17 +4,4 @@ package com.openlayer.api.services.async.commits -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse -import java.util.concurrent.CompletableFuture - -interface TestResultServiceAsync { - - /** List the test results for a commit (project version). */ - @JvmOverloads - fun list( - params: CommitTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} +interface TestResultServiceAsync 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 7429781..49a793d 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,17 +3,9 @@ package com.openlayer.api.services.async.commits import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl constructor( @@ -21,34 +13,4 @@ constructor( ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the test results for a commit (project version). */ - override fun list( - params: CommitTestResultListParams, - requestOptions: RequestOptions - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0), "results") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 f7fb4cd..2e301ea 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 @@ -4,17 +4,4 @@ package com.openlayer.api.services.async.inferencePipelines -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse -import java.util.concurrent.CompletableFuture - -interface DataServiceAsync { - - /** Stream production data to an inference pipeline in Openlayer. */ - @JvmOverloads - fun stream( - params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} +interface DataServiceAsync 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 4a155d3..331f7d8 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,18 +3,9 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl constructor( @@ -22,35 +13,4 @@ constructor( ) : DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Stream production data to an inference pipeline in Openlayer. */ - override fun stream( - params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { streamHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 3ef1da7..94500d8 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 @@ -4,17 +4,4 @@ package com.openlayer.api.services.async.inferencePipelines -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse -import java.util.concurrent.CompletableFuture - -interface TestResultServiceAsync { - - /** List the test results under an inference pipeline. */ - @JvmOverloads - fun list( - params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} +interface TestResultServiceAsync 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 568e64f..b167dc4 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,17 +3,9 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl constructor( @@ -21,34 +13,4 @@ constructor( ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the test results under 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 ee9833d..7a39f1f 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 @@ -4,17 +4,4 @@ package com.openlayer.api.services.async.projects -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse -import java.util.concurrent.CompletableFuture - -interface CommitServiceAsync { - - /** List the commits (project versions) under a project. */ - @JvmOverloads - fun list( - params: ProjectCommitListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture -} +interface CommitServiceAsync 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 41174a6..8963663 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,17 +3,9 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl constructor( @@ -21,34 +13,4 @@ constructor( ) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the commits (project versions) under a project. */ - override fun list( - params: ProjectCommitListParams, - requestOptions: RequestOptions - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "versions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } } 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 68db234..6f22d7a 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 @@ -4,16 +4,4 @@ package com.openlayer.api.services.blocking.commits -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse - -interface TestResultService { - - /** List the test results for a commit (project version). */ - @JvmOverloads - fun list( - params: CommitTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CommitTestResultListResponse -} +interface TestResultService 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 0992990..fa049ad 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,16 +3,9 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( @@ -20,33 +13,4 @@ constructor( ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the test results for a commit (project version). */ - override fun list( - params: CommitTestResultListParams, - requestOptions: RequestOptions - ): CommitTestResultListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0), "results") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 ecfe2e5..be45c79 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 @@ -4,16 +4,4 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse - -interface DataService { - - /** Stream production data to an inference pipeline in Openlayer. */ - @JvmOverloads - fun stream( - params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions = RequestOptions.none() - ): InferencePipelineDataStreamResponse -} +interface DataService 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 31e69fe..0729faa 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,17 +3,9 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class DataServiceImpl constructor( @@ -21,34 +13,4 @@ constructor( ) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Stream production data to an inference pipeline in Openlayer. */ - override fun stream( - params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions - ): InferencePipelineDataStreamResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { streamHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 37774ae..909a068 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 @@ -4,16 +4,4 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse - -interface TestResultService { - - /** List the test results under an inference pipeline. */ - @JvmOverloads - fun list( - params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): InferencePipelineTestResultListResponse -} +interface TestResultService 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 edb9021..7deba57 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,16 +3,9 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( @@ -20,33 +13,4 @@ constructor( ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the test results under 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 b942ebd..c16b4ca 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 @@ -4,16 +4,4 @@ package com.openlayer.api.services.blocking.projects -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse - -interface CommitService { - - /** List the commits (project versions) under a project. */ - @JvmOverloads - fun list( - params: ProjectCommitListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectCommitListResponse -} +interface CommitService 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 0e91983..0a54d59 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,16 +3,9 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions -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.errors.OpenlayerError -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class CommitServiceImpl constructor( @@ -20,33 +13,4 @@ constructor( ) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the commits (project versions) under a project. */ - override fun list( - params: ProjectCommitListParams, - requestOptions: RequestOptions - ): ProjectCommitListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "versions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } } 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 deleted file mode 100644 index 01924b0..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class CommitTestResultListParamsTest { - - @Test - fun createCommitTestResultListParams() { - CommitTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() - } - - @Test - fun getQueryParams() { - val params = - CommitTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() - val expected = mutableMapOf>() - expected.put("includeArchived", listOf("true")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) - expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getQueryParamsWithoutOptionalFields() { - val params = - CommitTestResultListParams.builder().id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getPathParam() { - val params = - CommitTestResultListParams.builder().id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - assertThat(params).isNotNull - // path param "id" - 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/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt deleted file mode 100644 index 05c6717..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt +++ /dev/null @@ -1,161 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -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 { - - @Test - fun createCommitTestResultListResponse() { - val commitTestResultListResponse = - CommitTestResultListResponse.builder() - ._meta( - CommitTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - CommitTestResultListResponse.Item.Goal.Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - CommitTestResultListResponse.Item.Goal.Threshold - .Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - ) - .build() - assertThat(commitTestResultListResponse).isNotNull - assertThat(commitTestResultListResponse._meta()) - .isEqualTo( - CommitTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(commitTestResultListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - CommitTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - CommitTestResultListResponse.Item.Goal.Threshold.Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - } -} 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 deleted file mode 100644 index 37203d8..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt +++ /dev/null @@ -1,158 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class InferencePipelineDataStreamParamsTest { - - @Test - fun createInferencePipelineDataStreamParams() { - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - } - - @Test - fun getBody() { - val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.config()) - .isEqualTo( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - assertThat(body.rows()) - .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = - InferencePipelineDataStreamParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.config()) - .isEqualTo( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) - ) - assertThat(body.rows()) - .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - } - - @Test - fun getPathParam() { - val params = - InferencePipelineDataStreamParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - assertThat(params).isNotNull - // path param "id" - 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/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt deleted file mode 100644 index 5d5c07f..0000000 --- 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/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt deleted file mode 100644 index 0e1b9ea..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class InferencePipelineTestResultListParamsTest { - - @Test - fun createInferencePipelineTestResultListParams() { - InferencePipelineTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() - } - - @Test - fun getQueryParams() { - val params = - InferencePipelineTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() - val expected = mutableMapOf>() - expected.put("includeArchived", listOf("true")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put( - "status", - listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString()) - ) - expected.put( - "type", - listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) - ) - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getQueryParamsWithoutOptionalFields() { - val params = - InferencePipelineTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getPathParam() { - val params = - InferencePipelineTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "id" - 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/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt deleted file mode 100644 index d9eadbb..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt +++ /dev/null @@ -1,167 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -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 { - - @Test - fun createInferencePipelineTestResultListResponse() { - val inferencePipelineTestResultListResponse = - InferencePipelineTestResultListResponse.builder() - ._meta( - InferencePipelineTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - InferencePipelineTestResultListResponse.Item.Goal - .Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - InferencePipelineTestResultListResponse.Item - .Goal - .Threshold - .Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - ) - .build() - assertThat(inferencePipelineTestResultListResponse).isNotNull - assertThat(inferencePipelineTestResultListResponse._meta()) - .isEqualTo( - InferencePipelineTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(inferencePipelineTestResultListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - InferencePipelineTestResultListResponse.Item.Goal.Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - InferencePipelineTestResultListResponse.Item.Goal - .Threshold - .Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - } -} 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 deleted file mode 100644 index 83e994e..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class ProjectCommitListParamsTest { - - @Test - fun createProjectCommitListParams() { - ProjectCommitListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() - } - - @Test - fun getQueryParams() { - val params = - ProjectCommitListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getQueryParamsWithoutOptionalFields() { - val params = - ProjectCommitListParams.builder().id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getPathParam() { - val params = - ProjectCommitListParams.builder().id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - assertThat(params).isNotNull - // path param "id" - 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/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt deleted file mode 100644 index 72defbb..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt +++ /dev/null @@ -1,124 +0,0 @@ -// 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 ProjectCommitListResponseTest { - - @Test - fun createProjectCommitListResponse() { - val projectCommitListResponse = - ProjectCommitListResponse.builder() - ._meta( - ProjectCommitListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .gitCommitUrl("string") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links( - ProjectCommitListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .build() - ) - ) - .build() - assertThat(projectCommitListResponse).isNotNull - assertThat(projectCommitListResponse._meta()) - .isEqualTo( - ProjectCommitListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(projectCommitListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .gitCommitUrl("string") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links( - ProjectCommitListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .build() - ) - } -} 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 5d691bf..ff17e65 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 @@ -31,9 +31,6 @@ class ProjectCreateParamsTest { .rootDir("string") .build() ) - .slackChannelId("C01B2PZQX1Z") - .slackChannelName("#my-project") - .slackChannelNotificationsEnabled(true) .build() } @@ -60,9 +57,6 @@ class ProjectCreateParamsTest { .rootDir("string") .build() ) - .slackChannelId("C01B2PZQX1Z") - .slackChannelName("#my-project") - .slackChannelNotificationsEnabled(true) .build() val body = params.getBody() assertThat(body).isNotNull @@ -86,9 +80,6 @@ class ProjectCreateParamsTest { .rootDir("string") .build() ) - assertThat(body.slackChannelId()).isEqualTo("C01B2PZQX1Z") - assertThat(body.slackChannelName()).isEqualTo("#my-project") - assertThat(body.slackChannelNotificationsEnabled()).isEqualTo(true) } @Test 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/ProjectCreateResponseTest.kt index 3fca2c5..1adc950 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/ProjectCreateResponseTest.kt @@ -28,7 +28,6 @@ class ProjectCreateResponseTest { ) .monitoringGoalCount(123L) .name("My Project") - .sample(true) .source(ProjectCreateResponse.Source.WEB) .taskType(ProjectCreateResponse.TaskType.LLM_BASE) .versionCount(123L) @@ -50,10 +49,6 @@ class ProjectCreateResponseTest { .rootDir("string") .build() ) - .slackChannelId("C01B2PZQX1Z") - .slackChannelName("#my-project") - .slackChannelNotificationsEnabled(true) - .unreadNotificationCount(123L) .build() assertThat(projectCreateResponse).isNotNull assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -76,7 +71,6 @@ class ProjectCreateResponseTest { ) assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) assertThat(projectCreateResponse.name()).isEqualTo("My Project") - assertThat(projectCreateResponse.sample()).isEqualTo(true) assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) assertThat(projectCreateResponse.taskType()) .isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) @@ -101,9 +95,5 @@ class ProjectCreateResponseTest { .rootDir("string") .build() ) - assertThat(projectCreateResponse.slackChannelId()).contains("C01B2PZQX1Z") - assertThat(projectCreateResponse.slackChannelName()).contains("#my-project") - assertThat(projectCreateResponse.slackChannelNotificationsEnabled()).contains(true) - assertThat(projectCreateResponse.unreadNotificationCount()).contains(123L) } } 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 afb6ebb..949d211 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 @@ -40,7 +40,6 @@ class ProjectListResponseTest { ) .monitoringGoalCount(123L) .name("My Project") - .sample(true) .source(ProjectListResponse.Item.Source.WEB) .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) .versionCount(123L) @@ -62,10 +61,6 @@ class ProjectListResponseTest { .rootDir("string") .build() ) - .slackChannelId("C01B2PZQX1Z") - .slackChannelName("#my-project") - .slackChannelNotificationsEnabled(true) - .unreadNotificationCount(123L) .build() ) ) @@ -100,7 +95,6 @@ class ProjectListResponseTest { ) .monitoringGoalCount(123L) .name("My Project") - .sample(true) .source(ProjectListResponse.Item.Source.WEB) .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) .versionCount(123L) @@ -122,10 +116,6 @@ class ProjectListResponseTest { .rootDir("string") .build() ) - .slackChannelId("C01B2PZQX1Z") - .slackChannelName("#my-project") - .slackChannelNotificationsEnabled(true) - .unreadNotificationCount(123L) .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 fc8198c..9b8edf9 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.google.common.collect.ListMultimap import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper import com.openlayer.api.errors.BadRequestException import com.openlayer.api.errors.InternalServerException @@ -29,6 +28,7 @@ import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException import com.openlayer.api.models.* +import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.assertj.core.api.InstanceOfAssertFactories @@ -56,81 +56,99 @@ class ErrorHandlingTest { } @Test - fun dataStream200() { + fun projectsCreate200() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() val expected = - InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) + 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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectCreateResponse.Source.WEB) + .taskType(ProjectCreateResponse.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) .build() stubFor(post(anyUrl()).willReturn(ok().withBody(toJson(expected)))) - assertThat(client.inferencePipelines().data().stream(params)).isEqualTo(expected) + assertThat(client.projects().create(params)).isEqualTo(expected) } @Test - fun dataStream400() { + fun projectsCreate400() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -138,44 +156,35 @@ class ErrorHandlingTest { .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun dataStream401() { + fun projectsCreate401() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -183,44 +192,35 @@ class ErrorHandlingTest { .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertUnauthorized(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun dataStream403() { + fun projectsCreate403() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -228,44 +228,35 @@ class ErrorHandlingTest { .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun dataStream404() { + fun projectsCreate404() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -273,44 +264,35 @@ class ErrorHandlingTest { .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun dataStream422() { + fun projectsCreate422() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -318,7 +300,7 @@ class ErrorHandlingTest { .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertUnprocessableEntity( e, @@ -329,37 +311,28 @@ class ErrorHandlingTest { } @Test - fun dataStream429() { + fun projectsCreate429() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -367,44 +340,35 @@ class ErrorHandlingTest { .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun dataStream500() { + fun projectsCreate500() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -412,7 +376,7 @@ class ErrorHandlingTest { .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) @@ -421,35 +385,26 @@ class ErrorHandlingTest { @Test fun unexpectedStatusCode() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -457,7 +412,7 @@ class ErrorHandlingTest { .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertUnexpectedStatusCodeException( e, @@ -471,40 +426,31 @@ class ErrorHandlingTest { @Test fun invalidBody() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor(post(anyUrl()).willReturn(status(200).withBody("Not JSON"))) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertThat(e) .isInstanceOf(OpenlayerException::class.java) @@ -515,40 +461,31 @@ class ErrorHandlingTest { @Test fun invalidErrorBody() { val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + assertThatThrownBy({ client.projects().create(params) }) .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().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 15b11a5..170e43e 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 @@ -21,6 +21,7 @@ import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper import com.openlayer.api.models.* +import java.time.OffsetDateTime import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -41,7 +42,7 @@ class ServiceParamsTest { } @Test - fun dataStreamWithAdditionalParams() { + fun projectsCreateWithAdditionalParams() { val additionalHeaders = mutableMapOf>() additionalHeaders.put("x-test-header", listOf("abc1234")) @@ -55,43 +56,70 @@ class ServiceParamsTest { additionalBodyProperties.put("testBodyProperty", JsonString.of("ghi890")) val params = - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .additionalHeaders(additionalHeaders) .additionalBodyProperties(additionalBodyProperties) .additionalQueryParams(additionalQueryParams) .build() val apiResponse = - InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) + 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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectCreateResponse.Source.WEB) + .taskType(ProjectCreateResponse.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("string") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("string") + .url("string") + .branch("string") + .rootDir("string") + .build() + ) .build() stubFor( @@ -102,7 +130,7 @@ class ServiceParamsTest { .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) ) - client.inferencePipelines().data().stream(params) + client.projects().create(params) verify(postRequestedFor(anyUrl())) } 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 e7e4e02..95cc0e1 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 @@ -42,9 +42,6 @@ class ProjectServiceTest { .rootDir("string") .build() ) - .slackChannelId("C01B2PZQX1Z") - .slackChannelName("#my-project") - .slackChannelNotificationsEnabled(true) .build() ) println(projectCreateResponse) 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 171aa44..752695d 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 @@ -3,34 +3,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.* -import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class TestResultServiceTest { - - @Test - fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val testResultService = client.commits().testResults() - val commitTestResultListResponse = - testResultService.list( - CommitTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() - ) - println(commitTestResultListResponse) - commitTestResultListResponse.validate() - } -} +@ExtendWith(TestServerExtension::class) class TestResultServiceTest 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 d004505..b8c0866 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 @@ -3,57 +3,7 @@ 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.* -import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class DataServiceTest { - - @Test - fun callStream() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val dataService = client.inferencePipelines().data() - val inferencePipelineDataStreamResponse = - dataService.stream( - InferencePipelineDataStreamParams.builder() - .id("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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - ) - println(inferencePipelineDataStreamResponse) - inferencePipelineDataStreamResponse.validate() - } -} +@ExtendWith(TestServerExtension::class) class DataServiceTest 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 c100166..f9bdd02 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 @@ -3,34 +3,7 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* -import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class TestResultServiceTest { - - @Test - fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val testResultService = client.inferencePipelines().testResults() - val inferencePipelineTestResultListResponse = - testResultService.list( - InferencePipelineTestResultListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() - ) - println(inferencePipelineTestResultListResponse) - inferencePipelineTestResultListResponse.validate() - } -} +@ExtendWith(TestServerExtension::class) class TestResultServiceTest 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 de43f45..231f03f 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 @@ -3,31 +3,7 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* -import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class CommitServiceTest { - - @Test - fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val commitService = client.projects().commits() - val projectCommitListResponse = - commitService.list( - ProjectCommitListParams.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() - ) - println(projectCommitListResponse) - projectCommitListResponse.validate() - } -} +@ExtendWith(TestServerExtension::class) class CommitServiceTest From 69c5aba6d450e4a924a1ec1bf8f427cd66ba29a0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 7 Jul 2024 02:28:27 +0000 Subject: [PATCH 04/21] feat(api): OpenAPI spec update via Stainless API (#9) --- .../com/openlayer/api/services/async/ProjectServiceAsync.kt | 4 ++-- .../openlayer/api/services/async/ProjectServiceAsyncImpl.kt | 4 ++-- .../com/openlayer/api/services/blocking/ProjectService.kt | 4 ++-- .../com/openlayer/api/services/blocking/ProjectServiceImpl.kt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) 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 936ec7e..bc149ca 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 @@ -19,14 +19,14 @@ interface ProjectServiceAsync { fun inferencePipelines(): InferencePipelineServiceAsync - /** Create a project under the current workspace. */ + /** Create a project in your workspace. */ @JvmOverloads fun create( params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none() ): CompletableFuture - /** List the projects in a user's workspace. */ + /** List your workspace's projects. */ @JvmOverloads fun list( params: ProjectListParams, 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 bc3ebdc..b49f449 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 @@ -42,7 +42,7 @@ constructor( private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Create a project under the current workspace. */ + /** Create a project in your workspace. */ override fun create( params: ProjectCreateParams, requestOptions: RequestOptions @@ -72,7 +72,7 @@ constructor( private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** List the projects in a user's workspace. */ + /** List your workspace's projects. */ override fun list( params: ProjectListParams, requestOptions: RequestOptions 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 1c34c22..a9e58d1 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 @@ -18,14 +18,14 @@ interface ProjectService { fun inferencePipelines(): InferencePipelineService - /** Create a project under the current workspace. */ + /** Create a project in your workspace. */ @JvmOverloads fun create( params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none() ): ProjectCreateResponse - /** List the projects in a user's workspace. */ + /** List your workspace's projects. */ @JvmOverloads fun list( params: ProjectListParams, 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 be94238..e441602 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 @@ -41,7 +41,7 @@ constructor( private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Create a project under the current workspace. */ + /** Create a project in your workspace. */ override fun create( params: ProjectCreateParams, requestOptions: RequestOptions @@ -70,7 +70,7 @@ constructor( private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** List the projects in a user's workspace. */ + /** List your workspace's projects. */ override fun list( params: ProjectListParams, requestOptions: RequestOptions From 75a4d984832a11a4561b7b45ef1667dad6e8bd0a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 7 Jul 2024 02:52:11 +0000 Subject: [PATCH 05/21] feat(api): update via SDK Studio (#10) --- .stats.yml | 2 +- README.md | 34 +- .../api/models/CommitTestResultListParams.kt | 379 +++ .../models/CommitTestResultListResponse.kt | 1664 ++++++++++++ .../InferencePipelineDataStreamParams.kt | 2240 +++++++++++++++++ .../InferencePipelineDataStreamResponse.kt | 161 ++ .../InferencePipelineTestResultListParams.kt | 369 +++ ...InferencePipelineTestResultListResponse.kt | 1666 ++++++++++++ .../api/models/ProjectCommitListParams.kt | 179 ++ .../api/models/ProjectCommitListResponse.kt | 1308 ++++++++++ .../ProjectInferencePipelineCreateParams.kt | 449 ++++ .../ProjectInferencePipelineCreateResponse.kt | 613 +++++ .../ProjectInferencePipelineListParams.kt | 194 ++ .../ProjectInferencePipelineListResponse.kt | 897 +++++++ .../async/commits/TestResultServiceAsync.kt | 15 +- .../commits/TestResultServiceAsyncImpl.kt | 38 + .../inferencePipelines/DataServiceAsync.kt | 15 +- .../DataServiceAsyncImpl.kt | 40 + .../TestResultServiceAsync.kt | 15 +- .../TestResultServiceAsyncImpl.kt | 38 + .../async/projects/CommitServiceAsync.kt | 15 +- .../async/projects/CommitServiceAsyncImpl.kt | 38 + .../projects/InferencePipelineServiceAsync.kt | 24 +- .../InferencePipelineServiceAsyncImpl.kt | 72 + .../blocking/commits/TestResultService.kt | 14 +- .../blocking/commits/TestResultServiceImpl.kt | 36 + .../inferencePipelines/DataService.kt | 14 +- .../inferencePipelines/DataServiceImpl.kt | 38 + .../inferencePipelines/TestResultService.kt | 14 +- .../TestResultServiceImpl.kt | 36 + .../blocking/projects/CommitService.kt | 14 +- .../blocking/projects/CommitServiceImpl.kt | 36 + .../projects/InferencePipelineService.kt | 23 +- .../projects/InferencePipelineServiceImpl.kt | 69 + .../models/CommitTestResultListParamsTest.kt | 65 + .../CommitTestResultListResponseTest.kt | 161 ++ .../InferencePipelineDataStreamParamsTest.kt | 158 ++ ...InferencePipelineDataStreamResponseTest.kt | 20 + ...ferencePipelineTestResultListParamsTest.kt | 68 + ...rencePipelineTestResultListResponseTest.kt | 167 ++ .../api/models/ProjectCommitListParamsTest.kt | 56 + .../models/ProjectCommitListResponseTest.kt | 124 + ...rojectInferencePipelineCreateParamsTest.kt | 59 + ...jectInferencePipelineCreateResponseTest.kt | 71 + .../ProjectInferencePipelineListParamsTest.kt | 59 + ...rojectInferencePipelineListResponseTest.kt | 92 + .../api/services/ErrorHandlingTest.kt | 597 +++-- .../api/services/ServiceParamsTest.kt | 92 +- .../blocking/commits/TestResultServiceTest.kt | 29 +- .../inferencePipelines/DataServiceTest.kt | 52 +- .../TestResultServiceTest.kt | 28 +- .../blocking/projects/CommitServiceTest.kt | 26 +- .../projects/InferencePipelineServiceTest.kt | 47 +- 53 files changed, 12375 insertions(+), 355 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt diff --git a/.stats.yml b/.stats.yml index fcbfe48..699660e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 2 +configured_endpoints: 8 diff --git a/README.md b/README.md index 6885a35..4a4d0de 100644 --- a/README.md +++ b/README.md @@ -68,15 +68,25 @@ Read the documentation for more configuration options. ### Example: creating a resource -To create a new project, first use the `ProjectCreateParams` builder to specify attributes, -then pass that to the `create` method of the `projects` service. +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. ```java -import com.openlayer.api.models.ProjectCreateParams; -import com.openlayer.api.models.ProjectCreateResponse; - -ProjectCreateParams params = ProjectCreateParams.builder().build(); -ProjectCreateResponse projectCreateResponse = client.projects().create(params); +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import java.util.List; + +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() + .rows(List.of(InferencePipelineDataStreamParams.Row.builder().build())) + .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .costColumnName("cost") + .inputVariableNames(List.of("user_query")) + .numOfTokenColumnName("tokens") + .timestampColumnName("timestamp") + .build())) + .build(); +InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream(params); ``` --- @@ -87,14 +97,14 @@ ProjectCreateResponse projectCreateResponse = client.projects().create(params); 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 `ProjectCreateParams.builder()` to pass to -the `create` method of the `projects` service. +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. ```java -ProjectCreateParams params = ProjectCreateParams.builder() +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() // ... normal properties .putAdditionalProperty("secret_param", "4242") .build(); @@ -107,7 +117,7 @@ ProjectCreateParams params = ProjectCreateParams.builder() 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 -ProjectCreateResponse projectCreateResponse = client.projects().create().validate(); +InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream().validate(); ``` ### Response properties as JSON @@ -137,7 +147,7 @@ if (field.isMissing()) { 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: ```java -JsonValue secret = projectCreateResponse._additionalProperties().get("secret_field"); +JsonValue secret = inferencePipelineDataStreamResponse._additionalProperties().get("secret_field"); ``` --- 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 new file mode 100644 index 0000000..6b1c3e4 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -0,0 +1,379 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class CommitTestResultListParams +constructor( + private val projectVersionId: String, + private val includeArchived: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectVersionId(): String = projectVersionId + + fun includeArchived(): Optional = Optional.ofNullable(includeArchived) + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + fun status(): Optional = Optional.ofNullable(status) + + fun type(): Optional = Optional.ofNullable(type) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.includeArchived?.let { params.put("includeArchived", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.status?.let { params.put("status", listOf(it.toString())) } + this.type?.let { params.put("type", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectVersionId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CommitTestResultListParams && + this.projectVersionId == other.projectVersionId && + this.includeArchived == other.includeArchived && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectVersionId, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var projectVersionId: String? = null + private var includeArchived: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var status: Status? = null + private var type: Type? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(commitTestResultListParams: CommitTestResultListParams) = apply { + this.projectVersionId = commitTestResultListParams.projectVersionId + this.includeArchived = commitTestResultListParams.includeArchived + this.page = commitTestResultListParams.page + this.perPage = commitTestResultListParams.perPage + this.status = commitTestResultListParams.status + this.type = commitTestResultListParams.type + additionalQueryParams(commitTestResultListParams.additionalQueryParams) + additionalHeaders(commitTestResultListParams.additionalHeaders) + additionalBodyProperties(commitTestResultListParams.additionalBodyProperties) + } + + fun projectVersionId(projectVersionId: String) = apply { + this.projectVersionId = projectVersionId + } + + /** Include archived goals. */ + fun includeArchived(includeArchived: Boolean) = apply { + this.includeArchived = includeArchived + } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + /** + * 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 objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type) = apply { this.type = type } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): CommitTestResultListParams = + CommitTestResultListParams( + checkNotNull(projectVersionId) { "`projectVersionId` is required but was not set" }, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val INTEGRITY = Type(JsonField.of("integrity")) + + @JvmField val CONSISTENCY = Type(JsonField.of("consistency")) + + @JvmField val PERFORMANCE = Type(JsonField.of("performance")) + + @JvmField val FAIRNESS = Type(JsonField.of("fairness")) + + @JvmField val ROBUSTNESS = Type(JsonField.of("robustness")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + } + + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..731f3b5 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -0,0 +1,1664 @@ +// 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.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.NoAutoDetect +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable +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 +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): CommitTestResultListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CommitTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(commitTestResultListResponse: CommitTestResultListResponse) = apply { + this._meta = commitTestResultListResponse._meta + this.items = commitTestResultListResponse.items + additionalProperties(commitTestResultListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): CommitTestResultListResponse = + CommitTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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 start date. */ + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + + /** The data end date. */ + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + + /** The status of the test. */ + fun status(): Status = status.getRequired("status") + + /** The status message. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + /** Project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + + /** The test id. */ + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun _inferencePipelineId() = inferencePipelineId + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The data start date. */ + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + + /** The data end date. */ + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + + /** The status of the test. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + 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) + } + + /** 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 test id. */ + fun goalId(goalId: String) = goalId(JsonField.of(goalId)) + + /** The test id. */ + @JsonProperty("goalId") + @ExcludeMissing + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") + @ExcludeMissing + fun projectVersionId(projectVersionId: JsonField) = apply { + this.projectVersionId = projectVersionId + } + + /** 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 creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** 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 data start date. */ + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun dateDataStarts(dateDataStarts: JsonField) = apply { + this.dateDataStarts = dateDataStarts + } + + /** The data end date. */ + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) + + /** The data end date. */ + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun dateDataEnds(dateDataEnds: JsonField) = apply { + this.dateDataEnds = dateDataEnds + } + + /** 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)) + + /** The status message. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + 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(): Item = + Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = Goal.Builder::class) + @NoAutoDetect + class Goal + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The test id. */ + fun id(): String = id.getRequired("id") + + /** The test number. */ + fun number(): Long = number.getRequired("number") + + /** The test 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 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 subtype. */ + fun subtype(): String = subtype.getRequired("subtype") + + /** The test creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(): Optional = + Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** 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 number of comments on the test. */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** 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 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")) + + /** The test id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The test number. */ + @JsonProperty("number") @ExcludeMissing fun _number() = number + + /** The test name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = 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") + @ExcludeMissing + fun _evaluationWindow() = evaluationWindow + + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + + /** The test type. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The test subtype. */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + + /** The test creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId() = originProjectVersionId + + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + + /** Whether the test is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived() = 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 number of comments on the test. */ + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + + /** Whether the test uses an ML model. */ + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset() = usesValidationDataset + + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset() = usesTrainingDataset + + /** Whether the test uses a reference dataset (monitoring mode only). */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset() = usesReferenceDataset + + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData() = usesProductionData + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + 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 + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + 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, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 archived: JsonField = JsonMissing.of() + private var dateArchived: JsonField = JsonMissing.of() + private var suggested: JsonField = JsonMissing.of() + private var commentCount: 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 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) + } + + /** 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 test number. */ + @JsonProperty("number") + @ExcludeMissing + fun number(number: JsonField) = apply { this.number = number } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The test name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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 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 evaluation window in seconds. Only applies to tests that use production data. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) + + /** 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 type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** The test type. */ + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + /** 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)) + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + @JsonProperty("thresholds") + @ExcludeMissing + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds + } + + /** 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 date the test was archived. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") + @ExcludeMissing + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** The number of comments on the test. */ + @JsonProperty("commentCount") + @ExcludeMissing + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } + + /** 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 a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + 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 production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + 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(): Goal = + Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Threshold.Builder::class) + @NoAutoDetect + class Threshold + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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")) + + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) + + /** The operator to be used for the evaluation. */ + fun operator(): Optional = + Optional.ofNullable(operator.getNullable("operator")) + + /** 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("insightParameters") + @ExcludeMissing + fun _insightParameters() = insightParameters + + /** The operator to be used for the evaluation. */ + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + + /** The value to be compared. */ + @JsonProperty("value") @ExcludeMissing fun _value() = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Threshold = apply { + if (!validated) { + measurement() + insightName() + insightParameters() + operator() + value() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var measurement: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: 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 + } + + /** 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 + } + + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) + + @JsonProperty("insightParameters") + @ExcludeMissing + fun insightParameters(insightParameters: JsonField>) = apply { + this.insightParameters = insightParameters + } + + /** 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 } + + 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(): Threshold = + Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + fun double(): Optional = Optional.ofNullable(double) + + fun boolean(): Optional = Optional.ofNullable(boolean) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isDouble(): Boolean = double != null + + fun isBoolean(): Boolean = boolean != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asDouble(): Double = double.getOrThrow("double") + + fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + } + + fun validate(): Value = apply { + if (!validated) { + if ( + double == null && + boolean == null && + string == null && + strings == null + ) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings + } + + override fun hashCode(): Int { + return Objects.hash( + double, + boolean, + string, + strings, + ) + } + + override fun toString(): String { + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + } + + companion object { + + @JvmStatic fun ofDouble(double: Double) = Value(double = double) + + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + interface Visitor { + + fun visitDouble(double: Double): T + + fun visitBoolean(boolean: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) + } + } + + class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + 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") + } + } + } + } + } + } + } +} 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 new file mode 100644 index 0000000..e2f6f84 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -0,0 +1,2240 @@ +// 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.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.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.getOrThrow +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineDataStreamParams +constructor( + private val inferencePipelineId: String, + private val config: Config, + private val rows: List, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + fun config(): Config = config + + fun rows(): List = rows + + @JvmSynthetic + internal fun getBody(): InferencePipelineDataStreamBody { + return InferencePipelineDataStreamBody( + config, + rows, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + @JsonDeserialize(builder = InferencePipelineDataStreamBody.Builder::class) + @NoAutoDetect + class InferencePipelineDataStreamBody + internal constructor( + private val config: Config?, + private val rows: List?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + @JsonProperty("config") fun config(): Config? = config + + /** A list of entries that represent rows of a csv file */ + @JsonProperty("rows") fun rows(): List? = rows + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamBody && + this.config == other.config && + this.rows == other.rows && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + config, + rows, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var config: Config? = null + private var rows: List? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = + apply { + this.config = inferencePipelineDataStreamBody.config + this.rows = inferencePipelineDataStreamBody.rows + additionalProperties(inferencePipelineDataStreamBody.additionalProperties) + } + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + + /** A list of entries that represent rows of a csv file */ + @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } + + 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(): InferencePipelineDataStreamBody = + InferencePipelineDataStreamBody( + checkNotNull(config) { "`config` is required but was not set" }, + checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamParams && + this.inferencePipelineId == other.inferencePipelineId && + this.config == other.config && + this.rows == other.rows && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + config, + rows, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var config: Config? = null + private var rows: MutableList = mutableListOf() + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = + apply { + this.inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId + this.config = inferencePipelineDataStreamParams.config + this.rows(inferencePipelineDataStreamParams.rows) + additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) + additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) + additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(config: Config) = apply { this.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) } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(tabularClassificationData: Config.TabularClassificationData) = apply { + this.config = Config.ofTabularClassificationData(tabularClassificationData) + } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(tabularRegressionData: Config.TabularRegressionData) = apply { + this.config = Config.ofTabularRegressionData(tabularRegressionData) + } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(textClassificationData: Config.TextClassificationData) = apply { + this.config = Config.ofTextClassificationData(textClassificationData) + } + + /** A list of entries that represent rows of a csv file */ + fun rows(rows: List) = apply { + this.rows.clear() + this.rows.addAll(rows) + } + + /** A list of entries that represent rows of a csv file */ + fun addRow(row: Row) = apply { this.rows.add(row) } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineDataStreamParams = + InferencePipelineDataStreamParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + checkNotNull(config) { "`config` is required but was not set" }, + checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(using = Config.Deserializer::class) + @JsonSerialize(using = Config.Serializer::class) + class Config + private constructor( + private val llmData: LlmData? = null, + private val tabularClassificationData: TabularClassificationData? = null, + private val tabularRegressionData: TabularRegressionData? = null, + private val textClassificationData: TextClassificationData? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + fun llmData(): Optional = Optional.ofNullable(llmData) + + fun tabularClassificationData(): Optional = + Optional.ofNullable(tabularClassificationData) + + fun tabularRegressionData(): Optional = + Optional.ofNullable(tabularRegressionData) + + fun textClassificationData(): Optional = + Optional.ofNullable(textClassificationData) + + fun isLlmData(): Boolean = llmData != null + + fun isTabularClassificationData(): Boolean = tabularClassificationData != null + + fun isTabularRegressionData(): Boolean = tabularRegressionData != null + + fun isTextClassificationData(): Boolean = textClassificationData != null + + fun asLlmData(): LlmData = llmData.getOrThrow("llmData") + + fun asTabularClassificationData(): TabularClassificationData = + tabularClassificationData.getOrThrow("tabularClassificationData") + + fun asTabularRegressionData(): TabularRegressionData = + tabularRegressionData.getOrThrow("tabularRegressionData") + + fun asTextClassificationData(): TextClassificationData = + textClassificationData.getOrThrow("textClassificationData") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + llmData != null -> visitor.visitLlmData(llmData) + tabularClassificationData != null -> + visitor.visitTabularClassificationData(tabularClassificationData) + tabularRegressionData != null -> + visitor.visitTabularRegressionData(tabularRegressionData) + textClassificationData != null -> + visitor.visitTextClassificationData(textClassificationData) + else -> visitor.unknown(_json) + } + } + + 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 + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Config && + this.llmData == other.llmData && + this.tabularClassificationData == other.tabularClassificationData && + this.tabularRegressionData == other.tabularRegressionData && + this.textClassificationData == other.textClassificationData + } + + override fun hashCode(): Int { + return Objects.hash( + llmData, + tabularClassificationData, + tabularRegressionData, + textClassificationData, + ) + } + + override fun toString(): String { + return when { + llmData != null -> "Config{llmData=$llmData}" + tabularClassificationData != null -> + "Config{tabularClassificationData=$tabularClassificationData}" + tabularRegressionData != null -> + "Config{tabularRegressionData=$tabularRegressionData}" + textClassificationData != null -> + "Config{textClassificationData=$textClassificationData}" + _json != null -> "Config{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Config") + } + } + + companion object { + + @JvmStatic fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) + + @JvmStatic + fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = + Config(tabularClassificationData = tabularClassificationData) + + @JvmStatic + fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = + Config(tabularRegressionData = tabularRegressionData) + + @JvmStatic + fun ofTextClassificationData(textClassificationData: TextClassificationData) = + Config(textClassificationData = textClassificationData) + } + + interface Visitor { + + fun visitLlmData(llmData: LlmData): T + + fun visitTabularClassificationData( + tabularClassificationData: TabularClassificationData + ): T + + fun visitTabularRegressionData(tabularRegressionData: TabularRegressionData): T + + fun visitTextClassificationData(textClassificationData: TextClassificationData): T + + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Config: $json") + } + } + + class Deserializer : BaseDeserializer(Config::class) { + + 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) + } + } + + class Serializer : BaseSerializer(Config::class) { + + override fun serialize( + value: Config, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.llmData != null -> generator.writeObject(value.llmData) + value.tabularClassificationData != null -> + generator.writeObject(value.tabularClassificationData) + value.tabularRegressionData != null -> + generator.writeObject(value.tabularRegressionData) + value.textClassificationData != null -> + generator.writeObject(value.textClassificationData) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Config") + } + } + } + + @JsonDeserialize(builder = LlmData.Builder::class) + @NoAutoDetect + class LlmData + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(): Optional = + Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + + /** + * Name of the column with the context retrieved. Applies to RAG use cases. Providing + * the context enables RAG-specific metrics. + */ + fun contextColumnName(): Optional = + Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) + + /** Name of the column with the cost associated with each row. */ + fun costColumnName(): Optional = + Optional.ofNullable(costColumnName.getNullable("costColumnName")) + + /** Name of the column with the ground truths. */ + 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. + */ + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** Array of input variable names. Each input variable should be a dataset column. */ + fun inputVariableNames(): Optional> = + Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model outputs. */ + fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") + + /** Prompt for the LLM. */ + 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. + */ + fun questionColumnName(): Optional = + Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** Name of the column with the total number of tokens. */ + @JsonProperty("numOfTokenColumnName") + @ExcludeMissing + fun _numOfTokenColumnName() = numOfTokenColumnName + + /** + * 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 + + /** Name of the column with the cost associated with each row. */ + @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName + + /** Name of the column with the ground truths. */ + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + fun _groundTruthColumnName() = 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** Array of input variable names. Each input variable should be a dataset column. */ + @JsonProperty("inputVariableNames") + @ExcludeMissing + fun _inputVariableNames() = inputVariableNames + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model outputs. */ + @JsonProperty("outputColumnName") + @ExcludeMissing + fun _outputColumnName() = outputColumnName + + /** Prompt for the LLM. */ + @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt + + /** + * 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 + + /** + * 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 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): LlmData = apply { + if (!validated) { + numOfTokenColumnName() + contextColumnName() + costColumnName() + groundTruthColumnName() + inferenceIdColumnName() + inputVariableNames() + latencyColumnName() + outputColumnName() + prompt().map { it.forEach { it.validate() } } + questionColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LlmData && + this.numOfTokenColumnName == other.numOfTokenColumnName && + this.contextColumnName == other.contextColumnName && + this.costColumnName == other.costColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.inputVariableNames == other.inputVariableNames && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.outputColumnName == other.outputColumnName && + this.prompt == other.prompt && + this.questionColumnName == other.questionColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames, + latencyColumnName, + metadata, + outputColumnName, + prompt, + questionColumnName, + timestampColumnName, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var numOfTokenColumnName: JsonField = JsonMissing.of() + 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 latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var outputColumnName: JsonField = JsonMissing.of() + private var prompt: JsonField> = JsonMissing.of() + 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) + } + + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(numOfTokenColumnName: String) = + numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) + + /** 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 context retrieved. Applies to RAG use cases. + * Providing the context enables RAG-specific metrics. + */ + fun contextColumnName(contextColumnName: String) = + contextColumnName(JsonField.of(contextColumnName)) + + /** + * 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 + } + + /** Name of the column with the cost associated with each row. */ + fun costColumnName(costColumnName: String) = + 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 + } + + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(groundTruthColumnName: String) = + groundTruthColumnName(JsonField.of(groundTruthColumnName)) + + /** Name of the column with the ground truths. */ + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { + this.groundTruthColumnName = 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. + */ + fun inferenceIdColumnName(inferenceIdColumnName: String) = + 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** + * Array of input variable names. Each input variable should be a dataset column. + */ + fun inputVariableNames(inputVariableNames: List) = + inputVariableNames(JsonField.of(inputVariableNames)) + + /** + * Array of input variable names. Each input variable should be a dataset column. + */ + @JsonProperty("inputVariableNames") + @ExcludeMissing + fun inputVariableNames(inputVariableNames: JsonField>) = apply { + this.inputVariableNames = inputVariableNames + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + 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 model outputs. */ + @JsonProperty("outputColumnName") + @ExcludeMissing + fun outputColumnName(outputColumnName: JsonField) = apply { + this.outputColumnName = outputColumnName + } + + /** 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 } + + /** + * Name of the column with the questions. Applies to RAG use cases. Providing the + * question enables RAG-specific metrics. + */ + fun questionColumnName(questionColumnName: String) = + questionColumnName(JsonField.of(questionColumnName)) + + /** + * 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 + } + + /** + * 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: String) = + 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. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): LlmData = + LlmData( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames.map { it.toUnmodifiable() }, + latencyColumnName, + metadata, + outputColumnName, + prompt.map { it.toUnmodifiable() }, + questionColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Prompt.Builder::class) + @NoAutoDetect + class Prompt + private constructor( + private val role: JsonField, + private val content: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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 + + /** Content of the prompt. */ + @JsonProperty("content") @ExcludeMissing fun _content() = content + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Prompt = apply { + if (!validated) { + role() + content() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Prompt && + this.role == other.role && + this.content == other.content && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + role, + content, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var role: JsonField = JsonMissing.of() + private var content: 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) + } + + /** 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 } + + 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(): Prompt = + Prompt( + role, + content, + additionalProperties.toUnmodifiable(), + ) + } + } + } + + @JsonDeserialize(builder = TabularClassificationData.Builder::class) + @NoAutoDetect + class TabularClassificationData + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + 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")) + + /** + * 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(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun _categoricalFeatureNames() = categoricalFeatureNames + + /** + * 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 + + /** Array with all input feature names. */ + @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** + * 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 + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun _predictionsColumnName() = predictionsColumnName + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + fun _predictionScoresColumnName() = predictionScoresColumnName + + /** + * 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 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TabularClassificationData = apply { + if (!validated) { + categoricalFeatureNames() + classNames() + featureNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TabularClassificationData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.classNames == other.classNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + categoricalFeatureNames, + classNames, + featureNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var categoricalFeatureNames: JsonField> = JsonMissing.of() + private var classNames: JsonField> = JsonMissing.of() + private var featureNames: JsonField> = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var labelColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var predictionsColumnName: JsonField = JsonMissing.of() + private var predictionScoresColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @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 = + tabularClassificationData.predictionScoresColumnName + this.timestampColumnName = tabularClassificationData.timestampColumnName + additionalProperties(tabularClassificationData.additionalProperties) + } + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + + /** + * 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 + } + + /** + * 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. + */ + @JsonProperty("classNames") + @ExcludeMissing + fun classNames(classNames: JsonField>) = apply { + this.classNames = classNames + } + + /** 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 + } + + /** + * 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: String) = + 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(labelColumnName: String) = + 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`. + */ + @JsonProperty("labelColumnName") + @ExcludeMissing + fun labelColumnName(labelColumnName: JsonField) = apply { + this.labelColumnName = labelColumnName + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + 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**. */ + fun predictionsColumnName(predictionsColumnName: String) = + 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 + } + + /** + * Name of the column with the model's predictions as **lists of class + * probabilities**. + */ + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + + /** + * 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 + } + + /** + * 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: String) = + 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. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): TabularClassificationData = + TabularClassificationData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + classNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = TabularRegressionData.Builder::class) + @NoAutoDetect + class TabularRegressionData + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + fun categoricalFeatureNames(): Optional> = + Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + + /** Array with all input feature names. */ + 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. + */ + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model's predictions. */ + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + + /** Name of the column with the targets (ground truth values). */ + 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. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun _categoricalFeatureNames() = categoricalFeatureNames + + /** Array with all input feature names. */ + @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model's predictions. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun _predictionsColumnName() = predictionsColumnName + + /** Name of the column with the targets (ground truth values). */ + @JsonProperty("targetColumnName") + @ExcludeMissing + fun _targetColumnName() = targetColumnName + + /** + * 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 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TabularRegressionData = apply { + if (!validated) { + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + latencyColumnName() + predictionsColumnName() + targetColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TabularRegressionData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.targetColumnName == other.targetColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + categoricalFeatureNames, + featureNames, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var categoricalFeatureNames: JsonField> = JsonMissing.of() + private var featureNames: JsonField> = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var predictionsColumnName: JsonField = JsonMissing.of() + private var targetColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @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) + } + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + + /** + * 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 + } + + /** 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 + } + + /** + * 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: String) = + 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + 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. */ + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) + + /** Name of the column with the model's predictions. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun predictionsColumnName(predictionsColumnName: JsonField) = apply { + this.predictionsColumnName = predictionsColumnName + } + + /** Name of the column with the targets (ground truth values). */ + fun targetColumnName(targetColumnName: String) = + 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 + } + + /** + * 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: String) = + 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. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): TabularRegressionData = + TabularRegressionData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = TextClassificationData.Builder::class) + @NoAutoDetect + class TextClassificationData + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * 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") + + /** + * 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(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) + + /** Name of the column with the text data. */ + 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. + */ + 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. + */ + @JsonProperty("classNames") @ExcludeMissing fun _classNames() = 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** + * 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 + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun _predictionsColumnName() = predictionsColumnName + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + fun _predictionScoresColumnName() = predictionScoresColumnName + + /** Name of the column with the text data. */ + @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName() = textColumnName + + /** + * 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 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TextClassificationData = apply { + if (!validated) { + classNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + textColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TextClassificationData && + this.classNames == other.classNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.textColumnName == other.textColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + classNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var classNames: JsonField> = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var labelColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var predictionsColumnName: JsonField = JsonMissing.of() + private var predictionScoresColumnName: JsonField = JsonMissing.of() + private var textColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @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) + } + + /** + * 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. + */ + @JsonProperty("classNames") + @ExcludeMissing + fun classNames(classNames: JsonField>) = apply { + this.classNames = 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. + */ + fun inferenceIdColumnName(inferenceIdColumnName: String) = + 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. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(labelColumnName: String) = + 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`. + */ + @JsonProperty("labelColumnName") + @ExcludeMissing + fun labelColumnName(labelColumnName: JsonField) = apply { + this.labelColumnName = labelColumnName + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + 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**. */ + fun predictionsColumnName(predictionsColumnName: String) = + 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 + } + + /** + * Name of the column with the model's predictions as **lists of class + * probabilities**. + */ + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + + /** + * 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 + } + + /** Name of the column with the text data. */ + fun textColumnName(textColumnName: String) = + textColumnName(JsonField.of(textColumnName)) + + /** Name of the column with the text data. */ + @JsonProperty("textColumnName") + @ExcludeMissing + fun textColumnName(textColumnName: JsonField) = apply { + this.textColumnName = textColumnName + } + + /** + * 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: String) = + 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. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): TextClassificationData = + TextClassificationData( + classNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } + } + + @JsonDeserialize(builder = Row.Builder::class) + @NoAutoDetect + class Row + private constructor( + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Row && this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode + } + + override fun toString() = "Row{additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(row: Row) = apply { additionalProperties(row.additionalProperties) } + + 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(): Row = Row(additionalProperties.toUnmodifiable()) + } + } +} 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 new file mode 100644 index 0000000..087ceda --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -0,0 +1,161 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) +@NoAutoDetect +class InferencePipelineDataStreamResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun success(): Success = success.getRequired("success") + + @JsonProperty("success") @ExcludeMissing fun _success() = success + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineDataStreamResponse = apply { + if (!validated) { + success() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode + } + + override fun toString() = + "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var success: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse + ) = apply { + this.success = inferencePipelineDataStreamResponse.success + additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): InferencePipelineDataStreamResponse = + InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) + } + + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Success && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val TRUE = Success(JsonField.of(true)) + + @JvmStatic fun of(value: Boolean) = Success(JsonField.of(value)) + } + + enum class Known { + TRUE, + } + + enum class Value { + TRUE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..e82d5a1 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -0,0 +1,369 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineTestResultListParams +constructor( + private val inferencePipelineId: String, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + fun status(): Optional = Optional.ofNullable(status) + + fun type(): Optional = Optional.ofNullable(type) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.status?.let { params.put("status", listOf(it.toString())) } + this.type?.let { params.put("type", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListParams && + this.inferencePipelineId == other.inferencePipelineId && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var status: Status? = null + private var type: Type? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + inferencePipelineTestResultListParams: InferencePipelineTestResultListParams + ) = apply { + this.inferencePipelineId = inferencePipelineTestResultListParams.inferencePipelineId + this.page = inferencePipelineTestResultListParams.page + this.perPage = inferencePipelineTestResultListParams.perPage + this.status = inferencePipelineTestResultListParams.status + this.type = inferencePipelineTestResultListParams.type + additionalQueryParams(inferencePipelineTestResultListParams.additionalQueryParams) + additionalHeaders(inferencePipelineTestResultListParams.additionalHeaders) + additionalBodyProperties(inferencePipelineTestResultListParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + /** + * 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 objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type) = apply { this.type = type } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineTestResultListParams = + InferencePipelineTestResultListParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val INTEGRITY = Type(JsonField.of("integrity")) + + @JvmField val CONSISTENCY = Type(JsonField.of("consistency")) + + @JvmField val PERFORMANCE = Type(JsonField.of("performance")) + + @JvmField val FAIRNESS = Type(JsonField.of("fairness")) + + @JvmField val ROBUSTNESS = Type(JsonField.of("robustness")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + } + + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..045ce71 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -0,0 +1,1666 @@ +// 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.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.NoAutoDetect +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable +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 +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineTestResultListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse + ) = apply { + this._meta = inferencePipelineTestResultListResponse._meta + this.items = inferencePipelineTestResultListResponse.items + additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): InferencePipelineTestResultListResponse = + InferencePipelineTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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 start date. */ + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + + /** The data end date. */ + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + + /** The status of the test. */ + fun status(): Status = status.getRequired("status") + + /** The status message. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + /** Project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + + /** The test id. */ + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun _inferencePipelineId() = inferencePipelineId + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The data start date. */ + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + + /** The data end date. */ + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + + /** The status of the test. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + 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) + } + + /** 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 test id. */ + fun goalId(goalId: String) = goalId(JsonField.of(goalId)) + + /** The test id. */ + @JsonProperty("goalId") + @ExcludeMissing + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") + @ExcludeMissing + fun projectVersionId(projectVersionId: JsonField) = apply { + this.projectVersionId = projectVersionId + } + + /** 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 creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** 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 data start date. */ + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun dateDataStarts(dateDataStarts: JsonField) = apply { + this.dateDataStarts = dateDataStarts + } + + /** The data end date. */ + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) + + /** The data end date. */ + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun dateDataEnds(dateDataEnds: JsonField) = apply { + this.dateDataEnds = dateDataEnds + } + + /** 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)) + + /** The status message. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + 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(): Item = + Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = Goal.Builder::class) + @NoAutoDetect + class Goal + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The test id. */ + fun id(): String = id.getRequired("id") + + /** The test number. */ + fun number(): Long = number.getRequired("number") + + /** The test 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 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 subtype. */ + fun subtype(): String = subtype.getRequired("subtype") + + /** The test creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(): Optional = + Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** 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 number of comments on the test. */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** 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 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")) + + /** The test id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The test number. */ + @JsonProperty("number") @ExcludeMissing fun _number() = number + + /** The test name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = 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") + @ExcludeMissing + fun _evaluationWindow() = evaluationWindow + + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + + /** The test type. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The test subtype. */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + + /** The test creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId() = originProjectVersionId + + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + + /** Whether the test is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived() = 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 number of comments on the test. */ + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + + /** Whether the test uses an ML model. */ + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset() = usesValidationDataset + + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset() = usesTrainingDataset + + /** Whether the test uses a reference dataset (monitoring mode only). */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset() = usesReferenceDataset + + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData() = usesProductionData + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + 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 + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + 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, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 archived: JsonField = JsonMissing.of() + private var dateArchived: JsonField = JsonMissing.of() + private var suggested: JsonField = JsonMissing.of() + private var commentCount: 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 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) + } + + /** 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 test number. */ + @JsonProperty("number") + @ExcludeMissing + fun number(number: JsonField) = apply { this.number = number } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The test name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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 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 evaluation window in seconds. Only applies to tests that use production data. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) + + /** 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 type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** The test type. */ + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + /** 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)) + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + @JsonProperty("thresholds") + @ExcludeMissing + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds + } + + /** 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 date the test was archived. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") + @ExcludeMissing + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** The number of comments on the test. */ + @JsonProperty("commentCount") + @ExcludeMissing + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } + + /** 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 a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + 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 production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + 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(): Goal = + Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Threshold.Builder::class) + @NoAutoDetect + class Threshold + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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")) + + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) + + /** The operator to be used for the evaluation. */ + fun operator(): Optional = + Optional.ofNullable(operator.getNullable("operator")) + + /** 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("insightParameters") + @ExcludeMissing + fun _insightParameters() = insightParameters + + /** The operator to be used for the evaluation. */ + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + + /** The value to be compared. */ + @JsonProperty("value") @ExcludeMissing fun _value() = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Threshold = apply { + if (!validated) { + measurement() + insightName() + insightParameters() + operator() + value() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var measurement: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: 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 + } + + /** 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 + } + + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) + + @JsonProperty("insightParameters") + @ExcludeMissing + fun insightParameters(insightParameters: JsonField>) = apply { + this.insightParameters = insightParameters + } + + /** 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 } + + 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(): Threshold = + Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + fun double(): Optional = Optional.ofNullable(double) + + fun boolean(): Optional = Optional.ofNullable(boolean) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isDouble(): Boolean = double != null + + fun isBoolean(): Boolean = boolean != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asDouble(): Double = double.getOrThrow("double") + + fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + } + + fun validate(): Value = apply { + if (!validated) { + if ( + double == null && + boolean == null && + string == null && + strings == null + ) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings + } + + override fun hashCode(): Int { + return Objects.hash( + double, + boolean, + string, + strings, + ) + } + + override fun toString(): String { + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + } + + companion object { + + @JvmStatic fun ofDouble(double: Double) = Value(double = double) + + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + interface Visitor { + + fun visitDouble(double: Double): T + + fun visitBoolean(boolean: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) + } + } + + class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + 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") + } + } + } + } + } + } + } +} 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 new file mode 100644 index 0000000..9266137 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -0,0 +1,179 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class ProjectCommitListParams +constructor( + private val projectId: String, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectId(): String = projectId + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCommitListParams && + this.projectId == other.projectId && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectId, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var projectId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCommitListParams: ProjectCommitListParams) = apply { + this.projectId = projectCommitListParams.projectId + this.page = projectCommitListParams.page + this.perPage = projectCommitListParams.perPage + additionalQueryParams(projectCommitListParams.additionalQueryParams) + additionalHeaders(projectCommitListParams.additionalHeaders) + additionalBodyProperties(projectCommitListParams.additionalBodyProperties) + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectCommitListParams = + ProjectCommitListParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..da9d1fd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -0,0 +1,1308 @@ +// 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.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.toUnmodifiable +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 +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectCommitListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCommitListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCommitListResponse: ProjectCommitListResponse) = apply { + this._meta = projectCommitListResponse._meta + this.items = projectCommitListResponse.items + additionalProperties(projectCommitListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): ProjectCommitListResponse = + ProjectCommitListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The project version (commit) id. */ + fun id(): String = id.getRequired("id") + + /** The project version (commit) creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * 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 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 model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** 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 commit archive date. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** 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") + + fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + + /** The project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project version (commit) creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** + * 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 + + /** The commit status message. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** 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 + + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId() = validationDatasetId + + /** The training dataset id. */ + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId() = trainingDatasetId + + /** 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 + + /** The total number of tests for the commit. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + 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 + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.dateCreated == other.dateCreated && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.projectId == other.projectId && + this.storageUri == other.storageUri && + this.commit == other.commit && + this.deploymentStatus == other.deploymentStatus && + this.mlModelId == other.mlModelId && + this.validationDatasetId == other.validationDatasetId && + this.trainingDatasetId == other.trainingDatasetId && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 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 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) + } + + /** 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 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 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`. + */ + @JsonProperty("status") + @ExcludeMissing + fun status(status: JsonField) = apply { this.status = status } + + /** The commit status message. */ + fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + + /** 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 details of a commit (project version). */ + @JsonProperty("commit") + @ExcludeMissing + fun commit(commit: JsonField) = apply { this.commit = commit } + + /** 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") + @ExcludeMissing + fun deploymentStatus(deploymentStatus: JsonField) = apply { + this.deploymentStatus = deploymentStatus + } + + /** The model id. */ + fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) + + /** 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 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)) + + /** 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(JsonField.of(archived)) + + /** 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 total number of tests for the commit. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Item = + Item( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties.toUnmodifiable(), + ) + } + + /** The details of a commit (project version). */ + @JsonDeserialize(builder = Commit.Builder::class) + @NoAutoDetect + class Commit + 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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")) + + /** The commit message. */ + fun message(): String = message.getRequired("message") + + /** The model id. */ + fun mlModelId(): Optional = + Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + + /** 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 SHA of the corresponding git commit. */ + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + + /** The ref of the corresponding git commit. */ + fun gitCommitRef(): Optional = + Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + + /** The URL of the corresponding git commit. */ + fun gitCommitUrl(): Optional = + Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + + /** The commit id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The author id of the commit. */ + @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId + + /** The commit creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The size of the commit bundle in bytes. */ + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize + + /** The commit message. */ + @JsonProperty("message") @ExcludeMissing fun _message() = message + + /** The model id. */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId() = validationDatasetId + + /** The training dataset id. */ + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId() = trainingDatasetId + + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + + /** The SHA of the corresponding git commit. */ + @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha + + /** The ref of the corresponding git commit. */ + @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef + + /** The URL of the corresponding git commit. */ + @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Commit = apply { + if (!validated) { + id() + authorId() + dateCreated() + fileSize() + message() + mlModelId() + validationDatasetId() + trainingDatasetId() + storageUri() + gitCommitSha() + gitCommitRef() + gitCommitUrl() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Commit && + this.id == other.id && + this.authorId == other.authorId && + this.dateCreated == other.dateCreated && + this.fileSize == other.fileSize && + this.message == other.message && + this.mlModelId == other.mlModelId && + this.validationDatasetId == other.validationDatasetId && + this.trainingDatasetId == other.trainingDatasetId && + this.storageUri == other.storageUri && + this.gitCommitSha == other.gitCommitSha && + this.gitCommitRef == other.gitCommitRef && + this.gitCommitUrl == other.gitCommitUrl && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties, + ) + } + return 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var authorId: JsonField = JsonMissing.of() + 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 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) + } + + /** 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 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(JsonField.of(fileSize)) + + /** 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)) + + /** 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 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)) + + /** 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 storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") + @ExcludeMissing + fun storageUri(storageUri: JsonField) = apply { + this.storageUri = storageUri + } + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) + + /** The SHA of the corresponding git commit. */ + @JsonProperty("gitCommitSha") + @ExcludeMissing + fun gitCommitSha(gitCommitSha: JsonField) = apply { + this.gitCommitSha = gitCommitSha + } + + /** 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 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Commit = + Commit( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties.toUnmodifiable(), + ) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + } +} 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 new file mode 100644 index 0000000..cab7c08 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -0,0 +1,449 @@ +// 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.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.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class ProjectInferencePipelineCreateParams +constructor( + private val projectId: String, + private val description: String?, + private val name: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectId(): String = projectId + + fun description(): Optional = Optional.ofNullable(description) + + fun name(): String = name + + @JvmSynthetic + internal fun getBody(): ProjectInferencePipelineCreateBody { + return ProjectInferencePipelineCreateBody( + description, + name, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectId + else -> "" + } + } + + @JsonDeserialize(builder = ProjectInferencePipelineCreateBody.Builder::class) + @NoAutoDetect + class ProjectInferencePipelineCreateBody + internal constructor( + private val description: String?, + private val name: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The inference pipeline description. */ + @JsonProperty("description") fun description(): String? = description + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(): String? = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateBody && + this.description == other.description && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + description, + name, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var description: String? = null + private var name: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody + ) = apply { + this.description = projectInferencePipelineCreateBody.description + this.name = projectInferencePipelineCreateBody.name + additionalProperties(projectInferencePipelineCreateBody.additionalProperties) + } + + /** The inference pipeline description. */ + @JsonProperty("description") + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + 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(): ProjectInferencePipelineCreateBody = + ProjectInferencePipelineCreateBody( + description, + checkNotNull(name) { "`name` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateParams && + this.projectId == other.projectId && + this.description == other.description && + this.name == other.name && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectId, + description, + name, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var projectId: String? = null + private var description: String? = null + private var name: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams + ) = apply { + this.projectId = projectInferencePipelineCreateParams.projectId + this.description = projectInferencePipelineCreateParams.description + this.name = projectInferencePipelineCreateParams.name + additionalQueryParams(projectInferencePipelineCreateParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineCreateParams.additionalHeaders) + additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** The inference pipeline description. */ + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + fun name(name: String) = apply { this.name = name } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectInferencePipelineCreateParams = + ProjectInferencePipelineCreateParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + description, + checkNotNull(name) { "`name` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("app") fun app(): String? = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + @JsonProperty("app") fun app(app: String) = apply { this.app = app } + + 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(): Links = + Links( + checkNotNull(app) { "`app` is required but was not set" }, + additionalProperties.toUnmodifiable() + ) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..acd34bb --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -0,0 +1,613 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = ProjectInferencePipelineCreateResponse.Builder::class) +@NoAutoDetect +class ProjectInferencePipelineCreateResponse +private constructor( + private val id: JsonField, + private val projectId: 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, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** 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 data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** 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 next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** 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 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")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** 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") + @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 + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectInferencePipelineCreateResponse = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: 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 additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse + ) = apply { + this.id = projectInferencePipelineCreateResponse.id + this.projectId = projectInferencePipelineCreateResponse.projectId + 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) + } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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.of(description)) + + /** 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 last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** 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 total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** 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)) + + /** 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)) + + @JsonProperty("links") + @ExcludeMissing + fun links(links: JsonField) = apply { this.links = links } + + 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(): ProjectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..1b909ab --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -0,0 +1,194 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class ProjectInferencePipelineListParams +constructor( + private val projectId: String, + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectId(): String = projectId + + fun name(): Optional = Optional.ofNullable(name) + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.name?.let { params.put("name", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListParams && + this.projectId == other.projectId && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectId, + name, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var projectId: String? = null + private var name: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = + apply { + this.projectId = projectInferencePipelineListParams.projectId + this.name = projectInferencePipelineListParams.name + this.page = projectInferencePipelineListParams.page + this.perPage = projectInferencePipelineListParams.perPage + additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineListParams.additionalHeaders) + additionalBodyProperties( + projectInferencePipelineListParams.additionalBodyProperties + ) + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** Filter list of items by name. */ + fun name(name: String) = apply { this.name = name } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectInferencePipelineListParams = + ProjectInferencePipelineListParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + name, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..cb9e840 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -0,0 +1,897 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = ProjectInferencePipelineListResponse.Builder::class) +@NoAutoDetect +class ProjectInferencePipelineListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectInferencePipelineListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineListResponse: ProjectInferencePipelineListResponse + ) = apply { + this._meta = projectInferencePipelineListResponse._meta + this.items = projectInferencePipelineListResponse.items + additionalProperties(projectInferencePipelineListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): ProjectInferencePipelineListResponse = + ProjectInferencePipelineListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + private constructor( + private val id: JsonField, + private val projectId: 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, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** 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 data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** 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 next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** 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 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")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** 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") + @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 + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Item{id=$id, projectId=$projectId, 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: 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 additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + this.id = item.id + this.projectId = item.projectId + 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) + } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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.of(description)) + + /** 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 last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** 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 total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** 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)) + + /** 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)) + + @JsonProperty("links") + @ExcludeMissing + fun links(links: JsonField) = apply { this.links = links } + + 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(): Item = + Item( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } + } +} 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 1eaf12d..dde3ea2 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 @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.commits -interface TestResultServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse +import java.util.concurrent.CompletableFuture + +interface TestResultServiceAsync { + + /** List the test results for a project commit (project version). */ + @JvmOverloads + 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 49a793d..ac4c25f 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,9 +3,17 @@ package com.openlayer.api.services.async.commits import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 2e301ea..26d5be9 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 @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -interface DataServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse +import java.util.concurrent.CompletableFuture + +interface DataServiceAsync { + + /** Stream production data to an inference pipeline. */ + @JvmOverloads + 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 331f7d8..33d3bfc 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,9 +3,18 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl constructor( @@ -13,4 +22,35 @@ constructor( ) : DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Stream production data 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 94500d8..5d526af 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 @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -interface TestResultServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse +import java.util.concurrent.CompletableFuture + +interface TestResultServiceAsync { + + /** List the latest test results for an inference pipeline. */ + @JvmOverloads + 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 b167dc4..0b4305b 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,9 +3,17 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 7a39f1f..cc723f2 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 @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.projects -interface CommitServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse +import java.util.concurrent.CompletableFuture + +interface CommitServiceAsync { + + /** List the commits (project versions) in a project. */ + @JvmOverloads + 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 8963663..9fb60aa 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,9 +3,17 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 39d03aa..a0a6c63 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 @@ -4,4 +4,26 @@ package com.openlayer.api.services.async.projects -interface InferencePipelineServiceAsync +import com.openlayer.api.core.RequestOptions +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 java.util.concurrent.CompletableFuture + +interface InferencePipelineServiceAsync { + + /** Create an inference pipeline in a project. */ + @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** List the inference pipelines in a project. */ + @JvmOverloads + 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 77cb45d..262589d 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,9 +3,20 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.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.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl constructor( @@ -13,4 +24,65 @@ constructor( ) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } 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 6f22d7a..5ad32ef 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 @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.commits -interface TestResultService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse + +interface TestResultService { + + /** List the test results for a project commit (project version). */ + @JvmOverloads + fun list( + params: CommitTestResultListParams, + 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 fa049ad..01739b4 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,9 +3,16 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( @@ -13,4 +20,33 @@ constructor( ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 be45c79..e165559 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 @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -interface DataService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse + +interface DataService { + + /** Stream production data to an inference pipeline. */ + @JvmOverloads + fun stream( + params: InferencePipelineDataStreamParams, + 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 0729faa..34cc6ce 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,9 +3,17 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class DataServiceImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Stream production data 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 909a068..24e0ca5 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 @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -interface TestResultService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse + +interface TestResultService { + + /** List the latest test results for an inference pipeline. */ + @JvmOverloads + fun list( + params: InferencePipelineTestResultListParams, + 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 7deba57..675b14f 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,9 +3,16 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( @@ -13,4 +20,33 @@ constructor( ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 c16b4ca..c9fb11e 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 @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.projects -interface CommitService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse + +interface CommitService { + + /** List the commits (project versions) in a project. */ + @JvmOverloads + fun list( + params: ProjectCommitListParams, + 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 0a54d59..6cb0342 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,9 +3,16 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class CommitServiceImpl constructor( @@ -13,4 +20,33 @@ constructor( ) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 e1f61c9..93989fb 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 @@ -4,4 +4,25 @@ package com.openlayer.api.services.blocking.projects -interface InferencePipelineService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.ProjectInferencePipelineListResponse + +interface InferencePipelineService { + + /** Create an inference pipeline in a project. */ + @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectInferencePipelineCreateResponse + + /** List the inference pipelines in a project. */ + @JvmOverloads + fun list( + params: ProjectInferencePipelineListParams, + 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 3b4bc5d..cb8655e 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,9 +3,19 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.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.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class InferencePipelineServiceImpl constructor( @@ -13,4 +23,63 @@ constructor( ) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } 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 new file mode 100644 index 0000000..a011d78 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class CommitTestResultListParamsTest { + + @Test + fun createCommitTestResultListParams() { + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + } + + @Test + fun getQueryParams() { + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("includeArchived", listOf("true")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) + expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + CommitTestResultListParams.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/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt new file mode 100644 index 0000000..05c6717 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt @@ -0,0 +1,161 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +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 { + + @Test + fun createCommitTestResultListResponse() { + val commitTestResultListResponse = + CommitTestResultListResponse.builder() + ._meta( + CommitTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + CommitTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + CommitTestResultListResponse.Item.Goal.Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + ) + .build() + assertThat(commitTestResultListResponse).isNotNull + assertThat(commitTestResultListResponse._meta()) + .isEqualTo( + CommitTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(commitTestResultListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + CommitTestResultListResponse.Item.Goal.Threshold.Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + } +} 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 new file mode 100644 index 0000000..de558c5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineDataStreamParamsTest { + + @Test + fun createInferencePipelineDataStreamParams() { + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()) + .isEqualTo( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + assertThat(body.rows()) + .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()) + .isEqualTo( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + assertThat(body.rows()) + .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + } + + @Test + fun getPathParam() { + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt new file mode 100644 index 0000000..5d5c07f --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt @@ -0,0 +1,20 @@ +// 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/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt new file mode 100644 index 0000000..6de2ac0 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineTestResultListParamsTest { + + @Test + fun createInferencePipelineTestResultListParams() { + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + } + + @Test + fun getQueryParams() { + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put( + "status", + listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString()) + ) + expected.put( + "type", + listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) + ) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + InferencePipelineTestResultListParams.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/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt new file mode 100644 index 0000000..d9eadbb --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt @@ -0,0 +1,167 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +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 { + + @Test + fun createInferencePipelineTestResultListResponse() { + val inferencePipelineTestResultListResponse = + InferencePipelineTestResultListResponse.builder() + ._meta( + InferencePipelineTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + InferencePipelineTestResultListResponse.Item.Goal + .Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + InferencePipelineTestResultListResponse.Item + .Goal + .Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + ) + .build() + assertThat(inferencePipelineTestResultListResponse).isNotNull + assertThat(inferencePipelineTestResultListResponse._meta()) + .isEqualTo( + InferencePipelineTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(inferencePipelineTestResultListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + InferencePipelineTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + InferencePipelineTestResultListResponse.Item.Goal + .Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + } +} 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 new file mode 100644 index 0000000..17d2e0a --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectCommitListParamsTest { + + @Test + fun createProjectCommitListParams() { + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + } + + @Test + fun getQueryParams() { + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + ProjectCommitListParams.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/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt new file mode 100644 index 0000000..72defbb --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt @@ -0,0 +1,124 @@ +// 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 ProjectCommitListResponseTest { + + @Test + fun createProjectCommitListResponse() { + val projectCommitListResponse = + ProjectCommitListResponse.builder() + ._meta( + ProjectCommitListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .gitCommitUrl("string") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(123L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(true) + .deploymentStatus("Deployed") + .links( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + ) + .build() + assertThat(projectCommitListResponse).isNotNull + assertThat(projectCommitListResponse._meta()) + .isEqualTo( + ProjectCommitListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectCommitListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .gitCommitUrl("string") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(123L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(true) + .deploymentStatus("Deployed") + .links( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + } +} 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 new file mode 100644 index 0000000..0e96084 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectInferencePipelineCreateParamsTest { + + @Test + fun createProjectInferencePipelineCreateParams() { + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() + } + + @Test + fun getBody() { + 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()).isEqualTo("This pipeline is used for production.") + assertThat(body.name()).isEqualTo("production") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("production") + } + + @Test + fun getPathParam() { + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .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/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt new file mode 100644 index 0000000..2398c71 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt @@ -0,0 +1,71 @@ +// 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 ProjectInferencePipelineCreateResponseTest { + + @Test + fun createProjectInferencePipelineCreateResponse() { + val projectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse.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(123L) + .links( + ProjectInferencePipelineCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + assertThat(projectInferencePipelineCreateResponse).isNotNull + assertThat(projectInferencePipelineCreateResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.description()) + .contains("This pipeline is used for production.") + assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.links()) + .isEqualTo( + ProjectInferencePipelineCreateResponse.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(123L) + assertThat(projectInferencePipelineCreateResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.status()) + .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) + assertThat(projectInferencePipelineCreateResponse.statusMessage()) + .contains("Tests successfully evaluated") + assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) + } +} 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 new file mode 100644 index 0000000..170fc1b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectInferencePipelineListParamsTest { + + @Test + fun createProjectInferencePipelineListParams() { + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + } + + @Test + fun getQueryParams() { + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("string")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + ProjectInferencePipelineListParams.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/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt new file mode 100644 index 0000000..37bb0ca --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt @@ -0,0 +1,92 @@ +// 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 ProjectInferencePipelineListResponseTest { + + @Test + fun createProjectInferencePipelineListResponse() { + val projectInferencePipelineListResponse = + ProjectInferencePipelineListResponse.builder() + ._meta( + ProjectInferencePipelineListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + ) + ) + .build() + assertThat(projectInferencePipelineListResponse).isNotNull + assertThat(projectInferencePipelineListResponse._meta()) + .isEqualTo( + ProjectInferencePipelineListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectInferencePipelineListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .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 9b8edf9..4dfd4b0 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,6 +16,7 @@ import com.google.common.collect.ListMultimap import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper import com.openlayer.api.errors.BadRequestException import com.openlayer.api.errors.InternalServerException @@ -28,7 +29,6 @@ import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException import com.openlayer.api.models.* -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.assertj.core.api.InstanceOfAssertFactories @@ -56,99 +56,81 @@ class ErrorHandlingTest { } @Test - fun projectsCreate200() { + fun dataStream200() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() val expected = - 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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectCreateResponse.Source.WEB) - .taskType(ProjectCreateResponse.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) .build() stubFor(post(anyUrl()).willReturn(ok().withBody(toJson(expected)))) - assertThat(client.projects().create(params)).isEqualTo(expected) + assertThat(client.inferencePipelines().data().stream(params)).isEqualTo(expected) } @Test - fun projectsCreate400() { + fun dataStream400() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -156,35 +138,44 @@ class ErrorHandlingTest { .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate401() { + fun dataStream401() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -192,35 +183,44 @@ class ErrorHandlingTest { .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertUnauthorized(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate403() { + fun dataStream403() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -228,35 +228,44 @@ class ErrorHandlingTest { .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate404() { + fun dataStream404() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -264,35 +273,44 @@ class ErrorHandlingTest { .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate422() { + fun dataStream422() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -300,7 +318,7 @@ class ErrorHandlingTest { .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertUnprocessableEntity( e, @@ -311,28 +329,37 @@ class ErrorHandlingTest { } @Test - fun projectsCreate429() { + fun dataStream429() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -340,35 +367,44 @@ class ErrorHandlingTest { .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate500() { + fun dataStream500() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -376,7 +412,7 @@ class ErrorHandlingTest { .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) @@ -385,26 +421,35 @@ class ErrorHandlingTest { @Test fun unexpectedStatusCode() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -412,7 +457,7 @@ class ErrorHandlingTest { .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertUnexpectedStatusCodeException( e, @@ -426,31 +471,40 @@ class ErrorHandlingTest { @Test fun invalidBody() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor(post(anyUrl()).willReturn(status(200).withBody("Not JSON"))) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertThat(e) .isInstanceOf(OpenlayerException::class.java) @@ -461,31 +515,40 @@ class ErrorHandlingTest { @Test fun invalidErrorBody() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().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 170e43e..4378175 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 @@ -21,7 +21,6 @@ import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper import com.openlayer.api.models.* -import java.time.OffsetDateTime import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -42,7 +41,7 @@ class ServiceParamsTest { } @Test - fun projectsCreateWithAdditionalParams() { + fun dataStreamWithAdditionalParams() { val additionalHeaders = mutableMapOf>() additionalHeaders.put("x-test-header", listOf("abc1234")) @@ -56,70 +55,43 @@ class ServiceParamsTest { additionalBodyProperties.put("testBodyProperty", JsonString.of("ghi890")) val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .additionalHeaders(additionalHeaders) .additionalBodyProperties(additionalBodyProperties) .additionalQueryParams(additionalQueryParams) .build() val apiResponse = - 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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectCreateResponse.Source.WEB) - .taskType(ProjectCreateResponse.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) .build() stubFor( @@ -130,7 +102,7 @@ class ServiceParamsTest { .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) ) - client.projects().create(params) + client.inferencePipelines().data().stream(params) verify(postRequestedFor(anyUrl())) } 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 752695d..1f87370 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 @@ -3,7 +3,34 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class TestResultServiceTest +@ExtendWith(TestServerExtension::class) +class TestResultServiceTest { + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.commits().testResults() + val commitTestResultListResponse = + testResultService.list( + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + ) + println(commitTestResultListResponse) + commitTestResultListResponse.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 b8c0866..0b70b54 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 @@ -3,7 +3,57 @@ 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.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class DataServiceTest +@ExtendWith(TestServerExtension::class) +class DataServiceTest { + + @Test + fun callStream() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dataService = client.inferencePipelines().data() + val inferencePipelineDataStreamResponse = + dataService.stream( + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + ) + println(inferencePipelineDataStreamResponse) + inferencePipelineDataStreamResponse.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 f9bdd02..67a11f1 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 @@ -3,7 +3,33 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class TestResultServiceTest +@ExtendWith(TestServerExtension::class) +class TestResultServiceTest { + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.inferencePipelines().testResults() + val inferencePipelineTestResultListResponse = + testResultService.list( + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + ) + println(inferencePipelineTestResultListResponse) + inferencePipelineTestResultListResponse.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 231f03f..83a9c12 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 @@ -3,7 +3,31 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class CommitServiceTest +@ExtendWith(TestServerExtension::class) +class CommitServiceTest { + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitService = client.projects().commits() + val projectCommitListResponse = + commitService.list( + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + ) + println(projectCommitListResponse) + projectCommitListResponse.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 778a046..5ee7b4e 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 @@ -3,7 +3,52 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceTest { + + @Test + fun callCreate() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineCreateResponse = + inferencePipelineService.create( + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() + ) + println(projectInferencePipelineCreateResponse) + projectInferencePipelineCreateResponse.validate() + } + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineListResponse = + inferencePipelineService.list( + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + ) + println(projectInferencePipelineListResponse) + projectInferencePipelineListResponse.validate() + } +} From f3a2e94096f7065baaf412330b4d82098144a7c6 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 9 Jul 2024 18:15:06 +0000 Subject: [PATCH 06/21] feat(api): OpenAPI spec update via Stainless API --- .github/workflows/create-releases.yml | 47 +++++++++++++++++ .../handle-release-pr-title-edit.yml | 25 ++++++++++ .github/workflows/publish-sonatype.yml | 8 +-- .github/workflows/release-doctor.yml | 1 + bin/check-release-environment | 4 ++ .../api/models/ProjectCreateParams.kt | 26 +--------- .../api/models/ProjectCreateParamsTest.kt | 50 ------------------- .../services/blocking/ProjectServiceTest.kt | 17 ------- 8 files changed, 81 insertions(+), 97 deletions(-) create mode 100644 .github/workflows/create-releases.yml create mode 100644 .github/workflows/handle-release-pr-title-edit.yml diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml new file mode 100644 index 0000000..58107af --- /dev/null +++ b/.github/workflows/create-releases.yml @@ -0,0 +1,47 @@ +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/handle-release-pr-title-edit.yml b/.github/workflows/handle-release-pr-title-edit.yml new file mode 100644 index 0000000..ac2a680 --- /dev/null +++ b/.github/workflows/handle-release-pr-title-edit.yml @@ -0,0 +1,25 @@ +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 }} diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 7dd499b..7535297 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 c09f373..985ba30 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -16,6 +16,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_ID: ${{ secrets.OPENLAYER_SONATYPE_GPG_SIGNING_KEY_ID || secrets.GPG_SIGNING_KEY_ID }} diff --git a/bin/check-release-environment b/bin/check-release-environment index 6fcdea6..81d5c65 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,6 +3,10 @@ warnings=() 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 warnings+=("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/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index dab084a..559574f 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,6 @@ constructor( private val name: String, private val taskType: TaskType, private val description: String?, - private val gitRepo: GitRepo?, private val additionalQueryParams: Map>, private val additionalHeaders: Map>, private val additionalBodyProperties: Map, @@ -36,15 +35,12 @@ constructor( fun description(): Optional = Optional.ofNullable(description) - fun gitRepo(): Optional = Optional.ofNullable(gitRepo) - @JvmSynthetic internal fun getBody(): ProjectCreateBody { return ProjectCreateBody( name, taskType, description, - gitRepo, additionalBodyProperties, ) } @@ -60,7 +56,6 @@ constructor( private val name: String?, private val taskType: TaskType?, private val description: String?, - private val gitRepo: GitRepo?, private val additionalProperties: Map, ) { @@ -75,8 +70,6 @@ constructor( /** The project description. */ @JsonProperty("description") fun description(): String? = description - @JsonProperty("gitRepo") fun gitRepo(): GitRepo? = gitRepo - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -92,7 +85,6 @@ constructor( this.name == other.name && this.taskType == other.taskType && this.description == other.description && - this.gitRepo == other.gitRepo && this.additionalProperties == other.additionalProperties } @@ -103,7 +95,6 @@ constructor( name, taskType, description, - gitRepo, additionalProperties, ) } @@ -111,7 +102,7 @@ constructor( } override fun toString() = - "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" companion object { @@ -123,7 +114,6 @@ constructor( private var name: String? = null private var taskType: TaskType? = null private var description: String? = null - private var gitRepo: GitRepo? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -131,7 +121,6 @@ constructor( this.name = projectCreateBody.name this.taskType = projectCreateBody.taskType this.description = projectCreateBody.description - this.gitRepo = projectCreateBody.gitRepo additionalProperties(projectCreateBody.additionalProperties) } @@ -146,9 +135,6 @@ constructor( @JsonProperty("description") fun description(description: String) = apply { this.description = description } - @JsonProperty("gitRepo") - fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() this.additionalProperties.putAll(additionalProperties) @@ -168,7 +154,6 @@ constructor( checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(taskType) { "`taskType` is required but was not set" }, description, - gitRepo, additionalProperties.toUnmodifiable(), ) } @@ -189,7 +174,6 @@ constructor( this.name == other.name && this.taskType == other.taskType && this.description == other.description && - this.gitRepo == other.gitRepo && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties @@ -200,7 +184,6 @@ constructor( name, taskType, description, - gitRepo, additionalQueryParams, additionalHeaders, additionalBodyProperties, @@ -208,7 +191,7 @@ constructor( } override fun toString() = - "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, gitRepo=$gitRepo, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -223,7 +206,6 @@ constructor( private var name: String? = null private var taskType: TaskType? = null private var description: String? = null - private var gitRepo: GitRepo? = null private var additionalQueryParams: MutableMap> = mutableMapOf() private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() @@ -233,7 +215,6 @@ constructor( this.name = projectCreateParams.name this.taskType = projectCreateParams.taskType this.description = projectCreateParams.description - this.gitRepo = projectCreateParams.gitRepo additionalQueryParams(projectCreateParams.additionalQueryParams) additionalHeaders(projectCreateParams.additionalHeaders) additionalBodyProperties(projectCreateParams.additionalBodyProperties) @@ -248,8 +229,6 @@ constructor( /** The project description. */ fun description(description: String) = apply { this.description = description } - fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() putAllQueryParams(additionalQueryParams) @@ -309,7 +288,6 @@ constructor( checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(taskType) { "`taskType` is required but was not set" }, description, - gitRepo, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalBodyProperties.toUnmodifiable(), 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 ff17e65..0a0a757 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 @@ -3,7 +3,6 @@ package com.openlayer.api.models import com.openlayer.api.models.* -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,22 +14,6 @@ class ProjectCreateParamsTest { .name("My Project") .taskType(ProjectCreateParams.TaskType.LLM_BASE) .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) .build() } @@ -41,45 +24,12 @@ class ProjectCreateParamsTest { .name("My Project") .taskType(ProjectCreateParams.TaskType.LLM_BASE) .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) .build() val body = params.getBody() 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.gitRepo()) - .isEqualTo( - 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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) } @Test 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 95cc0e1..5fc7f17 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 @@ -5,7 +5,6 @@ package com.openlayer.api.services.blocking import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* -import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -26,22 +25,6 @@ class ProjectServiceTest { .name("My Project") .taskType(ProjectCreateParams.TaskType.LLM_BASE) .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(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) .build() ) println(projectCreateResponse) From 3d51770cd80a882159c7bd267ebb4b1f82e1bbf2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:36:57 +0000 Subject: [PATCH 07/21] feat(api): OpenAPI spec update via Stainless API (#13) --- .github/workflows/ci.yml | 1 + README.md | 6 +++++- .../InferencePipelineDataStreamParams.kt | 8 ++++---- .../inferencePipelines/DataServiceAsync.kt | 2 +- .../DataServiceAsyncImpl.kt | 2 +- .../inferencePipelines/DataService.kt | 2 +- .../inferencePipelines/DataServiceImpl.kt | 2 +- .../models/ProjectCommitListResponseTest.kt | 4 ++-- .../api/models/ProjectCreateResponseTest.kt | 20 +++++++++---------- .../ProjectInferencePipelineListParamsTest.kt | 6 +++--- .../api/models/ProjectListParamsTest.kt | 6 +++--- .../api/models/ProjectListResponseTest.kt | 20 +++++++++---------- .../services/blocking/ProjectServiceTest.kt | 2 +- .../projects/InferencePipelineServiceTest.kt | 2 +- 14 files changed, 44 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5813609..008e387 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: pull_request: branches: - main + - next jobs: lint: diff --git a/README.md b/README.md index 4a4d0de..329fd2c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ 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). +The REST API documentation can be foundĀ on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). --- @@ -250,3 +250,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con 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/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 e2f6f84..62d6be9 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 @@ -76,7 +76,7 @@ constructor( /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ @JsonProperty("config") fun config(): Config? = config - /** A list of entries that represent rows of a csv file */ + /** A list of inference data points with inputs and outputs */ @JsonProperty("rows") fun rows(): List? = rows @JsonAnyGetter @@ -135,7 +135,7 @@ constructor( */ @JsonProperty("config") fun config(config: Config) = apply { this.config = config } - /** A list of entries that represent rows of a csv file */ + /** A list of inference data points with inputs and outputs */ @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } fun additionalProperties(additionalProperties: Map) = apply { @@ -248,13 +248,13 @@ constructor( this.config = Config.ofTextClassificationData(textClassificationData) } - /** A list of entries that represent rows of a csv file */ + /** A list of inference data points with inputs and outputs */ fun rows(rows: List) = apply { this.rows.clear() this.rows.addAll(rows) } - /** A list of entries that represent rows of a csv file */ + /** A list of inference data points with inputs and outputs */ fun addRow(row: Row) = apply { this.rows.add(row) } fun additionalQueryParams(additionalQueryParams: Map>) = apply { 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 26d5be9..18a6b9f 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 @@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture interface DataServiceAsync { - /** Stream production data to an inference pipeline. */ + /** Create an inference data point in an inference pipeline. */ @JvmOverloads fun stream( params: InferencePipelineDataStreamParams, 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 33d3bfc..55b2b75 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 @@ -27,7 +27,7 @@ constructor( jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) - /** Stream production data to an inference pipeline. */ + /** Create an inference data point in an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions 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 e165559..98680d0 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 @@ -10,7 +10,7 @@ import com.openlayer.api.models.InferencePipelineDataStreamResponse interface DataService { - /** Stream production data to an inference pipeline. */ + /** Create an inference data point in an inference pipeline. */ @JvmOverloads fun stream( params: InferencePipelineDataStreamParams, 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 34cc6ce..cc9431e 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 @@ -26,7 +26,7 @@ constructor( jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) - /** Stream production data to an inference pipeline. */ + /** Create an inference data point in an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions 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 72defbb..5793bd5 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 @@ -38,7 +38,7 @@ class ProjectCommitListResponseTest { .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .gitCommitRef("main") .gitCommitSha(123L) - .gitCommitUrl("string") + .gitCommitUrl("gitCommitUrl") .build() ) .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -94,7 +94,7 @@ class ProjectCommitListResponseTest { .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .gitCommitRef("main") .gitCommitSha(123L) - .gitCommitUrl("string") + .gitCommitUrl("gitCommitUrl") .build() ) .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) 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/ProjectCreateResponseTest.kt index 1adc950..1fc43bb 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/ProjectCreateResponseTest.kt @@ -40,13 +40,13 @@ class ProjectCreateResponseTest { .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .gitId(123L) - .name("string") + .name("name") .private_(true) .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") .build() ) .build() @@ -86,13 +86,13 @@ class ProjectCreateResponseTest { .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .gitId(123L) - .name("string") + .name("name") .private_(true) .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") .build() ) } 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 170fc1b..671b802 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 @@ -12,7 +12,7 @@ class ProjectInferencePipelineListParamsTest { fun createProjectInferencePipelineListParams() { ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") + .name("name") .page(123L) .perPage(100L) .build() @@ -23,12 +23,12 @@ class ProjectInferencePipelineListParamsTest { val params = ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") + .name("name") .page(123L) .perPage(100L) .build() val expected = mutableMapOf>() - expected.put("name", listOf("string")) + expected.put("name", listOf("name")) expected.put("page", listOf("123")) expected.put("perPage", listOf("100")) assertThat(params.getQueryParams()).isEqualTo(expected) 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 2daea94..daf73e7 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 @@ -11,7 +11,7 @@ class ProjectListParamsTest { @Test fun createProjectListParams() { ProjectListParams.builder() - .name("string") + .name("name") .page(123L) .perPage(100L) .taskType(ProjectListParams.TaskType.LLM_BASE) @@ -22,13 +22,13 @@ class ProjectListParamsTest { fun getQueryParams() { val params = ProjectListParams.builder() - .name("string") + .name("name") .page(123L) .perPage(100L) .taskType(ProjectListParams.TaskType.LLM_BASE) .build() val expected = mutableMapOf>() - expected.put("name", listOf("string")) + expected.put("name", listOf("name")) expected.put("page", listOf("123")) expected.put("perPage", listOf("100")) expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) 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 949d211..c30dee9 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 @@ -52,13 +52,13 @@ class ProjectListResponseTest { .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .gitId(123L) - .name("string") + .name("name") .private_(true) .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") .build() ) .build() @@ -107,13 +107,13 @@ class ProjectListResponseTest { .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .gitId(123L) - .name("string") + .name("name") .private_(true) .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") .build() ) .build() 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 5fc7f17..a87bdef 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 @@ -42,7 +42,7 @@ class ProjectServiceTest { val projectListResponse = projectService.list( ProjectListParams.builder() - .name("string") + .name("name") .page(123L) .perPage(100L) .taskType(ProjectListParams.TaskType.LLM_BASE) 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 5ee7b4e..ed1ee7c 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 @@ -43,7 +43,7 @@ class InferencePipelineServiceTest { inferencePipelineService.list( ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("string") + .name("name") .page(123L) .perPage(100L) .build() From b5ecd1cffeec8cc90c8fc37eb86d270671adcc73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:50:58 +0000 Subject: [PATCH 08/21] feat(api): update via SDK Studio (#14) --- .stats.yml | 2 +- .../InferencePipelineRowStreamParams.kt | 462 ++++++++++++++++++ .../InferencePipelineRowStreamResponse.kt | 160 ++++++ .../async/InferencePipelineServiceAsync.kt | 3 + .../InferencePipelineServiceAsyncImpl.kt | 6 + .../inferencePipelines/RowServiceAsync.kt | 20 + .../inferencePipelines/RowServiceAsyncImpl.kt | 56 +++ .../blocking/InferencePipelineService.kt | 3 + .../blocking/InferencePipelineServiceImpl.kt | 6 + .../blocking/inferencePipelines/RowService.kt | 19 + .../inferencePipelines/RowServiceImpl.kt | 54 ++ .../InferencePipelineRowStreamParamsTest.kt | 124 +++++ .../InferencePipelineRowStreamResponseTest.kt | 20 + .../inferencePipelines/RowServiceTest.kt | 43 ++ 14 files changed, 977 insertions(+), 1 deletion(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 699660e..de47912 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 8 +configured_endpoints: 9 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt new file mode 100644 index 0000000..64b926d --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt @@ -0,0 +1,462 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineRowStreamParams +constructor( + private val inferencePipelineId: String, + private val inferenceId: String, + private val row: JsonValue, + private val config: Config?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + fun inferenceId(): String = inferenceId + + fun row(): JsonValue = row + + fun config(): Optional = Optional.ofNullable(config) + + @JvmSynthetic + internal fun getBody(): InferencePipelineRowStreamBody { + return InferencePipelineRowStreamBody( + row, + config, + additionalBodyProperties, + ) + } + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.inferenceId.let { params.put("inferenceId", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + @JsonDeserialize(builder = InferencePipelineRowStreamBody.Builder::class) + @NoAutoDetect + class InferencePipelineRowStreamBody + internal constructor( + private val row: JsonValue?, + private val config: Config?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("row") fun row(): JsonValue? = row + + @JsonProperty("config") fun config(): Config? = config + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineRowStreamBody && + this.row == other.row && + this.config == other.config && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + row, + config, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineRowStreamBody{row=$row, config=$config, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var row: JsonValue? = null + private var config: Config? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineRowStreamBody: InferencePipelineRowStreamBody) = + apply { + this.row = inferencePipelineRowStreamBody.row + this.config = inferencePipelineRowStreamBody.config + additionalProperties(inferencePipelineRowStreamBody.additionalProperties) + } + + @JsonProperty("row") fun row(row: JsonValue) = apply { this.row = row } + + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + + 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(): InferencePipelineRowStreamBody = + InferencePipelineRowStreamBody( + checkNotNull(row) { "`row` is required but was not set" }, + config, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineRowStreamParams && + this.inferencePipelineId == other.inferencePipelineId && + this.row == other.row && + this.config == other.config && + this.inferenceId == other.inferenceId && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + row, + config, + inferenceId, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineRowStreamParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var inferenceId: String? = null + private var row: JsonValue? = null + private var config: Config? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineRowStreamParams: InferencePipelineRowStreamParams) = + apply { + this.inferencePipelineId = inferencePipelineRowStreamParams.inferencePipelineId + this.inferenceId = inferencePipelineRowStreamParams.inferenceId + this.row = inferencePipelineRowStreamParams.row + this.config = inferencePipelineRowStreamParams.config + additionalQueryParams(inferencePipelineRowStreamParams.additionalQueryParams) + additionalHeaders(inferencePipelineRowStreamParams.additionalHeaders) + additionalBodyProperties(inferencePipelineRowStreamParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** 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 config(config: Config) = apply { this.config = config } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineRowStreamParams = + InferencePipelineRowStreamParams( + 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, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Config.Builder::class) + @NoAutoDetect + class Config + 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, + ) { + + private var hashCode: Int = 0 + + /** + * 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 + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") fun latencyColumnName(): String? = 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 + + /** Name of the column with the ground truths. */ + @JsonProperty("groundTruthColumnName") + fun groundTruthColumnName(): String? = groundTruthColumnName + + /** Name of the column with human feedback. */ + @JsonProperty("humanFeedbackColumnName") + fun humanFeedbackColumnName(): String? = humanFeedbackColumnName + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Config && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.timestampColumnName == other.timestampColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.humanFeedbackColumnName == other.humanFeedbackColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + 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 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) + } + + /** + * 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 { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + fun latencyColumnName(latencyColumnName: String) = apply { + this.latencyColumnName = 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(timestampColumnName: String) = apply { + this.timestampColumnName = timestampColumnName + } + + /** Name of the column with the ground truths. */ + @JsonProperty("groundTruthColumnName") + fun groundTruthColumnName(groundTruthColumnName: String) = apply { + this.groundTruthColumnName = groundTruthColumnName + } + + /** Name of the column with human feedback. */ + @JsonProperty("humanFeedbackColumnName") + fun humanFeedbackColumnName(humanFeedbackColumnName: String) = apply { + this.humanFeedbackColumnName = humanFeedbackColumnName + } + + 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(): Config = + Config( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt new file mode 100644 index 0000000..c52d907 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt @@ -0,0 +1,160 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = InferencePipelineRowStreamResponse.Builder::class) +@NoAutoDetect +class InferencePipelineRowStreamResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun success(): Success = success.getRequired("success") + + @JsonProperty("success") @ExcludeMissing fun _success() = success + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineRowStreamResponse = apply { + if (!validated) { + success() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineRowStreamResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode + } + + override fun toString() = + "InferencePipelineRowStreamResponse{success=$success, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var success: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineRowStreamResponse: InferencePipelineRowStreamResponse) = + apply { + this.success = inferencePipelineRowStreamResponse.success + additionalProperties(inferencePipelineRowStreamResponse.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): InferencePipelineRowStreamResponse = + InferencePipelineRowStreamResponse(success, additionalProperties.toUnmodifiable()) + } + + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Success && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val TRUE = Success(JsonField.of(true)) + + @JvmStatic fun of(value: Boolean) = Success(JsonField.of(value)) + } + + enum class Known { + TRUE, + } + + enum class Value { + TRUE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 dd1d4d5..b4419d4 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 @@ -5,11 +5,14 @@ package com.openlayer.api.services.async import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync +import com.openlayer.api.services.async.inferencePipelines.RowServiceAsync import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync interface InferencePipelineServiceAsync { fun data(): DataServiceAsync + fun rows(): RowServiceAsync + fun testResults(): TestResultServiceAsync } 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 f2e5c2f..5518aff 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 @@ -7,6 +7,8 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError 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.services.errorHandler @@ -20,11 +22,15 @@ constructor( private val data: DataServiceAsync by lazy { DataServiceAsyncImpl(clientOptions) } + private val rows: RowServiceAsync by lazy { RowServiceAsyncImpl(clientOptions) } + private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } override fun data(): DataServiceAsync = data + override fun rows(): RowServiceAsync = rows + override fun testResults(): TestResultServiceAsync = testResults } 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 new file mode 100644 index 0000000..ce9b54b --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineRowStreamParams +import com.openlayer.api.models.InferencePipelineRowStreamResponse +import java.util.concurrent.CompletableFuture + +interface RowServiceAsync { + + /** Update an inference data point in an inference pipeline. */ + @JvmOverloads + fun stream( + params: InferencePipelineRowStreamParams, + 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 new file mode 100644 index 0000000..b13033e --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.inferencePipelines + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineRowStreamParams +import com.openlayer.api.models.InferencePipelineRowStreamResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class RowServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : RowServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update an inference data point in an inference pipeline. */ + override fun stream( + params: InferencePipelineRowStreamParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 161248f..157d71f 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 @@ -5,11 +5,14 @@ package com.openlayer.api.services.blocking 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 { fun data(): DataService + fun rows(): RowService + fun testResults(): TestResultService } 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 e83ed60..2267d4a 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 @@ -7,6 +7,8 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError 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.services.errorHandler @@ -20,9 +22,13 @@ constructor( private val data: DataService by lazy { DataServiceImpl(clientOptions) } + private val rows: RowService by lazy { RowServiceImpl(clientOptions) } + private val testResults: TestResultService by lazy { TestResultServiceImpl(clientOptions) } override fun data(): DataService = data + override fun rows(): RowService = rows + override fun testResults(): TestResultService = testResults } 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 new file mode 100644 index 0000000..68e608b --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt @@ -0,0 +1,19 @@ +// 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.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineRowStreamParams +import com.openlayer.api.models.InferencePipelineRowStreamResponse + +interface RowService { + + /** Update an inference data point in an inference pipeline. */ + @JvmOverloads + fun stream( + params: InferencePipelineRowStreamParams, + requestOptions: RequestOptions = RequestOptions.none() + ): InferencePipelineRowStreamResponse +} 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 new file mode 100644 index 0000000..09c5c4f --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.inferencePipelines + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineRowStreamParams +import com.openlayer.api.models.InferencePipelineRowStreamResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler + +class RowServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : RowService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update an inference data point in an inference pipeline. */ + override fun stream( + params: InferencePipelineRowStreamParams, + requestOptions: RequestOptions + ): InferencePipelineRowStreamResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt new file mode 100644 index 0000000..15f8668 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineRowStreamParamsTest { + + @Test + fun createInferencePipelineRowStreamParams() { + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowStreamParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + } + + @Test + fun getQueryParams() { + val params = + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowStreamParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getBody() { + val params = + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowStreamParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body.config()) + .isEqualTo( + InferencePipelineRowStreamParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + } + + @Test + fun getPathParam() { + val params = + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .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/InferencePipelineRowStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.kt new file mode 100644 index 0000000..2b615a5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.kt @@ -0,0 +1,20 @@ +// 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 InferencePipelineRowStreamResponseTest { + + @Test + fun createInferencePipelineRowStreamResponse() { + val inferencePipelineRowStreamResponse = + InferencePipelineRowStreamResponse.builder() + .success(InferencePipelineRowStreamResponse.Success.TRUE) + .build() + assertThat(inferencePipelineRowStreamResponse).isNotNull + assertThat(inferencePipelineRowStreamResponse.success()) + .isEqualTo(InferencePipelineRowStreamResponse.Success.TRUE) + } +} 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 new file mode 100644 index 0000000..bff5a32 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +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.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class RowServiceTest { + + @Test + fun callStream() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val rowService = client.inferencePipelines().rows() + val inferencePipelineRowStreamResponse = + rowService.stream( + InferencePipelineRowStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowStreamParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + ) + println(inferencePipelineRowStreamResponse) + inferencePipelineRowStreamResponse.validate() + } +} From ca3563b438c684f30bdc57fe95bd0bee33a0b201 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:55:08 +0000 Subject: [PATCH 09/21] feat(api): update via SDK Studio (#15) --- ...kt => InferencePipelineRowUpdateParams.kt} | 50 +++++++++---------- ... => InferencePipelineRowUpdateResponse.kt} | 20 ++++---- .../inferencePipelines/RowServiceAsync.kt | 10 ++-- .../inferencePipelines/RowServiceAsyncImpl.kt | 16 +++--- .../blocking/inferencePipelines/RowService.kt | 10 ++-- .../inferencePipelines/RowServiceImpl.kt | 16 +++--- .../InferencePipelineRowStreamResponseTest.kt | 20 -------- ...> InferencePipelineRowUpdateParamsTest.kt} | 24 ++++----- .../InferencePipelineRowUpdateResponseTest.kt | 20 ++++++++ .../inferencePipelines/RowServiceTest.kt | 14 +++--- 10 files changed, 100 insertions(+), 100 deletions(-) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineRowStreamParams.kt => InferencePipelineRowUpdateParams.kt} (90%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineRowStreamResponse.kt => InferencePipelineRowUpdateResponse.kt} (86%) delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.kt rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{InferencePipelineRowStreamParamsTest.kt => InferencePipelineRowUpdateParamsTest.kt} (86%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt similarity index 90% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index 64b926d..a8072f9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -14,7 +14,7 @@ import com.openlayer.api.models.* import java.util.Objects import java.util.Optional -class InferencePipelineRowStreamParams +class InferencePipelineRowUpdateParams constructor( private val inferencePipelineId: String, private val inferenceId: String, @@ -34,8 +34,8 @@ constructor( fun config(): Optional = Optional.ofNullable(config) @JvmSynthetic - internal fun getBody(): InferencePipelineRowStreamBody { - return InferencePipelineRowStreamBody( + internal fun getBody(): InferencePipelineRowUpdateBody { + return InferencePipelineRowUpdateBody( row, config, additionalBodyProperties, @@ -59,9 +59,9 @@ constructor( } } - @JsonDeserialize(builder = InferencePipelineRowStreamBody.Builder::class) + @JsonDeserialize(builder = InferencePipelineRowUpdateBody.Builder::class) @NoAutoDetect - class InferencePipelineRowStreamBody + class InferencePipelineRowUpdateBody internal constructor( private val row: JsonValue?, private val config: Config?, @@ -85,7 +85,7 @@ constructor( return true } - return other is InferencePipelineRowStreamBody && + return other is InferencePipelineRowUpdateBody && this.row == other.row && this.config == other.config && this.additionalProperties == other.additionalProperties @@ -104,7 +104,7 @@ constructor( } override fun toString() = - "InferencePipelineRowStreamBody{row=$row, config=$config, additionalProperties=$additionalProperties}" + "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" companion object { @@ -118,11 +118,11 @@ constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowStreamBody: InferencePipelineRowStreamBody) = + internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = apply { - this.row = inferencePipelineRowStreamBody.row - this.config = inferencePipelineRowStreamBody.config - additionalProperties(inferencePipelineRowStreamBody.additionalProperties) + this.row = inferencePipelineRowUpdateBody.row + this.config = inferencePipelineRowUpdateBody.config + additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) } @JsonProperty("row") fun row(row: JsonValue) = apply { this.row = row } @@ -143,8 +143,8 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowStreamBody = - InferencePipelineRowStreamBody( + fun build(): InferencePipelineRowUpdateBody = + InferencePipelineRowUpdateBody( checkNotNull(row) { "`row` is required but was not set" }, config, additionalProperties.toUnmodifiable(), @@ -163,7 +163,7 @@ constructor( return true } - return other is InferencePipelineRowStreamParams && + return other is InferencePipelineRowUpdateParams && this.inferencePipelineId == other.inferencePipelineId && this.row == other.row && this.config == other.config && @@ -186,7 +186,7 @@ constructor( } override fun toString() = - "InferencePipelineRowStreamParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -207,15 +207,15 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowStreamParams: InferencePipelineRowStreamParams) = + internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = apply { - this.inferencePipelineId = inferencePipelineRowStreamParams.inferencePipelineId - this.inferenceId = inferencePipelineRowStreamParams.inferenceId - this.row = inferencePipelineRowStreamParams.row - this.config = inferencePipelineRowStreamParams.config - additionalQueryParams(inferencePipelineRowStreamParams.additionalQueryParams) - additionalHeaders(inferencePipelineRowStreamParams.additionalHeaders) - additionalBodyProperties(inferencePipelineRowStreamParams.additionalBodyProperties) + this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId + this.inferenceId = inferencePipelineRowUpdateParams.inferenceId + this.row = inferencePipelineRowUpdateParams.row + this.config = inferencePipelineRowUpdateParams.config + additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) + additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) + additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) } fun inferencePipelineId(inferencePipelineId: String) = apply { @@ -283,8 +283,8 @@ constructor( this.additionalBodyProperties.putAll(additionalBodyProperties) } - fun build(): InferencePipelineRowStreamParams = - InferencePipelineRowStreamParams( + fun build(): InferencePipelineRowUpdateParams = + InferencePipelineRowUpdateParams( checkNotNull(inferencePipelineId) { "`inferencePipelineId` is required but was not set" }, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt similarity index 86% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index c52d907..35e877e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -17,9 +17,9 @@ import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects -@JsonDeserialize(builder = InferencePipelineRowStreamResponse.Builder::class) +@JsonDeserialize(builder = InferencePipelineRowUpdateResponse.Builder::class) @NoAutoDetect -class InferencePipelineRowStreamResponse +class InferencePipelineRowUpdateResponse private constructor( private val success: JsonField, private val additionalProperties: Map, @@ -37,7 +37,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): InferencePipelineRowStreamResponse = apply { + fun validate(): InferencePipelineRowUpdateResponse = apply { if (!validated) { success() validated = true @@ -51,7 +51,7 @@ private constructor( return true } - return other is InferencePipelineRowStreamResponse && + return other is InferencePipelineRowUpdateResponse && this.success == other.success && this.additionalProperties == other.additionalProperties } @@ -64,7 +64,7 @@ private constructor( } override fun toString() = - "InferencePipelineRowStreamResponse{success=$success, additionalProperties=$additionalProperties}" + "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" companion object { @@ -77,10 +77,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowStreamResponse: InferencePipelineRowStreamResponse) = + internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = apply { - this.success = inferencePipelineRowStreamResponse.success - additionalProperties(inferencePipelineRowStreamResponse.additionalProperties) + this.success = inferencePipelineRowUpdateResponse.success + additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) } fun success(success: Success) = success(JsonField.of(success)) @@ -103,8 +103,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowStreamResponse = - InferencePipelineRowStreamResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineRowUpdateResponse = + InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) } class Success 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 ce9b54b..4522c37 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 @@ -5,16 +5,16 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.InferencePipelineRowStreamParams -import com.openlayer.api.models.InferencePipelineRowStreamResponse +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import java.util.concurrent.CompletableFuture interface RowServiceAsync { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun stream( - params: InferencePipelineRowStreamParams, + fun update( + params: InferencePipelineRowUpdateParams, 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 index b13033e..9304fa7 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 @@ -8,8 +8,8 @@ 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.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineRowStreamParams -import com.openlayer.api.models.InferencePipelineRowStreamResponse +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler @@ -23,15 +23,15 @@ constructor( private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) /** Update an inference data point in an inference pipeline. */ - override fun stream( - params: InferencePipelineRowStreamParams, + override fun update( + params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -45,7 +45,7 @@ constructor( return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> response - .use { streamHandler.handle(it) } + .use { updateHandler.handle(it) } .apply { if (requestOptions.responseValidation ?: clientOptions.responseValidation) { 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 68e608b..3548f85 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 @@ -5,15 +5,15 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.RequestOptions -import com.openlayer.api.models.InferencePipelineRowStreamParams -import com.openlayer.api.models.InferencePipelineRowStreamResponse +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse interface RowService { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun stream( - params: InferencePipelineRowStreamParams, + fun update( + params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none() - ): InferencePipelineRowStreamResponse + ): 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 09c5c4f..d5f73a0 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 @@ -8,8 +8,8 @@ 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.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineRowStreamParams -import com.openlayer.api.models.InferencePipelineRowStreamResponse +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler @@ -22,15 +22,15 @@ constructor( private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) /** Update an inference data point in an inference pipeline. */ - override fun stream( - params: InferencePipelineRowStreamParams, + override fun update( + params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions - ): InferencePipelineRowStreamResponse { + ): InferencePipelineRowUpdateResponse { val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -43,7 +43,7 @@ constructor( .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response - .use { streamHandler.handle(it) } + .use { updateHandler.handle(it) } .apply { if (requestOptions.responseValidation ?: clientOptions.responseValidation) { validate() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.kt deleted file mode 100644 index 2b615a5..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamResponseTest.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 InferencePipelineRowStreamResponseTest { - - @Test - fun createInferencePipelineRowStreamResponse() { - val inferencePipelineRowStreamResponse = - InferencePipelineRowStreamResponse.builder() - .success(InferencePipelineRowStreamResponse.Success.TRUE) - .build() - assertThat(inferencePipelineRowStreamResponse).isNotNull - assertThat(inferencePipelineRowStreamResponse.success()) - .isEqualTo(InferencePipelineRowStreamResponse.Success.TRUE) - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt similarity index 86% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt index 15f8668..f4a70bf 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt @@ -7,15 +7,15 @@ import com.openlayer.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineRowStreamParamsTest { +class InferencePipelineRowUpdateParamsTest { @Test - fun createInferencePipelineRowStreamParams() { - InferencePipelineRowStreamParams.builder() + fun createInferencePipelineRowUpdateParams() { + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowStreamParams.Config.builder() + InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .inferenceIdColumnName("id") @@ -30,11 +30,11 @@ class InferencePipelineRowStreamParamsTest { @Test fun getQueryParams() { val params = - InferencePipelineRowStreamParams.builder() + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowStreamParams.Config.builder() + InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .inferenceIdColumnName("id") @@ -52,7 +52,7 @@ class InferencePipelineRowStreamParamsTest { @Test fun getQueryParamsWithoutOptionalFields() { val params = - InferencePipelineRowStreamParams.builder() + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .inferenceId("inferenceId") @@ -65,11 +65,11 @@ class InferencePipelineRowStreamParamsTest { @Test fun getBody() { val params = - InferencePipelineRowStreamParams.builder() + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowStreamParams.Config.builder() + InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .inferenceIdColumnName("id") @@ -84,7 +84,7 @@ class InferencePipelineRowStreamParamsTest { assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.config()) .isEqualTo( - InferencePipelineRowStreamParams.Config.builder() + InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .inferenceIdColumnName("id") @@ -97,7 +97,7 @@ class InferencePipelineRowStreamParamsTest { @Test fun getBodyWithoutOptionalFields() { val params = - InferencePipelineRowStreamParams.builder() + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .inferenceId("inferenceId") @@ -110,7 +110,7 @@ class InferencePipelineRowStreamParamsTest { @Test fun getPathParam() { val params = - InferencePipelineRowStreamParams.builder() + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .inferenceId("inferenceId") 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 new file mode 100644 index 0000000..427675b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt @@ -0,0 +1,20 @@ +// 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/services/blocking/inferencePipelines/RowServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt index bff5a32..8347fd9 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,20 +13,20 @@ import org.junit.jupiter.api.extension.ExtendWith class RowServiceTest { @Test - fun callStream() { + fun callUpdate() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val rowService = client.inferencePipelines().rows() - val inferencePipelineRowStreamResponse = - rowService.stream( - InferencePipelineRowStreamParams.builder() + val inferencePipelineRowUpdateResponse = + rowService.update( + InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowStreamParams.Config.builder() + InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .inferenceIdColumnName("id") @@ -37,7 +37,7 @@ class RowServiceTest { .inferenceId("inferenceId") .build() ) - println(inferencePipelineRowStreamResponse) - inferencePipelineRowStreamResponse.validate() + println(inferencePipelineRowUpdateResponse) + inferencePipelineRowUpdateResponse.validate() } } From 700e5dd17a46e547f1a2433993bbb4b586ae2159 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 04:20:13 +0000 Subject: [PATCH 10/21] feat(api): OpenAPI spec update via Stainless API (#16) --- .../api/services/async/inferencePipelines/DataServiceAsync.kt | 2 +- .../services/async/inferencePipelines/DataServiceAsyncImpl.kt | 2 +- .../api/services/blocking/inferencePipelines/DataService.kt | 2 +- .../api/services/blocking/inferencePipelines/DataServiceImpl.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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 18a6b9f..4f079ec 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 @@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture interface DataServiceAsync { - /** Create an inference data point in an inference pipeline. */ + /** Publish an inference data point to an inference pipeline. */ @JvmOverloads fun stream( params: InferencePipelineDataStreamParams, 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 55b2b75..bbbf784 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 @@ -27,7 +27,7 @@ constructor( jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) - /** Create an inference data point in an inference pipeline. */ + /** Publish an inference data point to an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions 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 98680d0..bbfd2cf 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 @@ -10,7 +10,7 @@ import com.openlayer.api.models.InferencePipelineDataStreamResponse interface DataService { - /** Create an inference data point in an inference pipeline. */ + /** Publish an inference data point to an inference pipeline. */ @JvmOverloads fun stream( params: InferencePipelineDataStreamParams, 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 cc9431e..41c4268 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 @@ -26,7 +26,7 @@ constructor( jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) - /** Create an inference data point in an inference pipeline. */ + /** Publish an inference data point to an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions From ef0d7e9c91d7798039e01600b762b13f1f5ada23 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:11:29 +0000 Subject: [PATCH 11/21] chore(ci): limit release doctor target branches (#17) --- .github/workflows/release-doctor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 985ba30..6f68e09 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,6 +1,8 @@ name: Release Doctor on: pull_request: + branches: + - main workflow_dispatch: jobs: From ff15d6179d277e41ab1910b69e90e49323530e3b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:13:37 +0000 Subject: [PATCH 12/21] chore(internal): codegen related update (#18) --- .stats.yml | 2 +- .../openlayer/api/client/OpenlayerClient.kt | 2 + .../api/client/OpenlayerClientAsync.kt | 2 + .../api/client/OpenlayerClientAsyncImpl.kt | 4 + .../api/client/OpenlayerClientImpl.kt | 4 + .../models/StoragePresignedUrlCreateParams.kt | 156 ++++++++++++++++++ .../StoragePresignedUrlCreateResponse.kt | 152 +++++++++++++++++ .../api/services/async/StorageServiceAsync.kt | 12 ++ .../services/async/StorageServiceAsyncImpl.kt | 24 +++ .../async/storage/PresignedUrlServiceAsync.kt | 20 +++ .../storage/PresignedUrlServiceAsyncImpl.kt | 56 +++++++ .../api/services/blocking/StorageService.kt | 12 ++ .../services/blocking/StorageServiceImpl.kt | 22 +++ .../blocking/storage/PresignedUrlService.kt | 19 +++ .../storage/PresignedUrlServiceImpl.kt | 54 ++++++ .../StoragePresignedUrlCreateParamsTest.kt | 31 ++++ .../StoragePresignedUrlCreateResponseTest.kt | 25 +++ .../services/blocking/StorageServiceTest.kt | 9 + .../storage/PresignedUrlServiceTest.kt | 29 ++++ 19 files changed, 634 insertions(+), 1 deletion(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt diff --git a/.stats.yml b/.stats.yml index de47912..af63a6f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 9 +configured_endpoints: 10 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 1f528fc..3a24286 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 @@ -16,4 +16,6 @@ interface OpenlayerClient { fun commits(): CommitService fun inferencePipelines(): InferencePipelineService + + fun storage(): StorageService } 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 57d71e1..7d8847c 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 @@ -16,4 +16,6 @@ interface OpenlayerClientAsync { fun commits(): CommitServiceAsync fun inferencePipelines(): InferencePipelineServiceAsync + + fun storage(): StorageServiceAsync } 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 a6a4ee6..d3c13ec 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,8 @@ constructor( InferencePipelineServiceAsyncImpl(clientOptions) } + private val storage: StorageServiceAsync by lazy { StorageServiceAsyncImpl(clientOptions) } + override fun sync(): OpenlayerClient = sync override fun projects(): ProjectServiceAsync = projects @@ -33,4 +35,6 @@ constructor( override fun commits(): CommitServiceAsync = commits override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines + + override fun storage(): StorageServiceAsync = 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 e8378b1..29a6187 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,8 @@ constructor( InferencePipelineServiceImpl(clientOptions) } + private val storage: StorageService by lazy { StorageServiceImpl(clientOptions) } + override fun async(): OpenlayerClientAsync = async override fun projects(): ProjectService = projects @@ -33,4 +35,6 @@ constructor( override fun commits(): CommitService = commits override fun inferencePipelines(): InferencePipelineService = inferencePipelines + + override fun storage(): StorageService = storage } 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 new file mode 100644 index 0000000..e5085a5 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -0,0 +1,156 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class StoragePresignedUrlCreateParams +constructor( + private val objectName: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun objectName(): String = objectName + + @JvmSynthetic + internal fun getBody(): Optional> { + return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + } + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.objectName.let { params.put("objectName", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateParams && + this.objectName == other.objectName && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + objectName, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var objectName: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = + apply { + this.objectName = storagePresignedUrlCreateParams.objectName + additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) + additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) + additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) + } + + /** The name of the object. */ + fun objectName(objectName: String) = apply { this.objectName = objectName } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): StoragePresignedUrlCreateParams = + StoragePresignedUrlCreateParams( + checkNotNull(objectName) { "`objectName` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..57c2fca --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -0,0 +1,152 @@ +// 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.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.toUnmodifiable +import java.util.Objects + +@JsonDeserialize(builder = StoragePresignedUrlCreateResponse.Builder::class) +@NoAutoDetect +class StoragePresignedUrlCreateResponse +private constructor( + private val url: JsonField, + private val fields: JsonValue, + private val storageUri: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** 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 + + /** Fields to include in the body of the upload. Only needed by s3. */ + @JsonProperty("fields") @ExcludeMissing fun _fields() = fields + + /** The storage URI to send back to the backend after the upload was completed. */ + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): StoragePresignedUrlCreateResponse = apply { + if (!validated) { + url() + storageUri() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateResponse && + this.url == other.url && + this.fields == other.fields && + this.storageUri == other.storageUri && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + url, + fields, + storageUri, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var url: JsonField = JsonMissing.of() + 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) + } + + /** 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): StoragePresignedUrlCreateResponse = + StoragePresignedUrlCreateResponse( + url, + fields, + storageUri, + additionalProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..6a59073 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt @@ -0,0 +1,12 @@ +// 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.services.async.storage.PresignedUrlServiceAsync + +interface StorageServiceAsync { + + fun presignedUrl(): PresignedUrlServiceAsync +} 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 new file mode 100644 index 0000000..2dd732c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync +import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl +import com.openlayer.api.services.errorHandler + +class StorageServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : StorageServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val presignedUrl: PresignedUrlServiceAsync by lazy { + PresignedUrlServiceAsyncImpl(clientOptions) + } + + override fun presignedUrl(): PresignedUrlServiceAsync = presignedUrl +} 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 new file mode 100644 index 0000000..933abd8 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.openlayer.api.core.RequestOptions +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import java.util.concurrent.CompletableFuture + +interface PresignedUrlServiceAsync { + + /** Retrieve a presigned url to post storage artifacts. */ + @JvmOverloads + 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 new file mode 100644 index 0000000..65a6972 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.storage + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class PresignedUrlServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : PresignedUrlServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().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() + } + } + } + } +} 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 new file mode 100644 index 0000000..bd8b0a0 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt @@ -0,0 +1,12 @@ +// 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.services.blocking.storage.PresignedUrlService + +interface StorageService { + + fun presignedUrl(): PresignedUrlService +} 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 new file mode 100644 index 0000000..25ff043 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.blocking.storage.PresignedUrlService +import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl +import com.openlayer.api.services.errorHandler + +class StorageServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : StorageService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val presignedUrl: PresignedUrlService by lazy { PresignedUrlServiceImpl(clientOptions) } + + override fun presignedUrl(): PresignedUrlService = presignedUrl +} 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 new file mode 100644 index 0000000..6cc179e --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt @@ -0,0 +1,19 @@ +// 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.openlayer.api.core.RequestOptions +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse + +interface PresignedUrlService { + + /** Retrieve a presigned url to post storage artifacts. */ + @JvmOverloads + fun create( + params: StoragePresignedUrlCreateParams, + 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 new file mode 100644 index 0000000..dabbfe5 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.storage + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler + +class PresignedUrlServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : PresignedUrlService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().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() + } + } + } + } +} 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 new file mode 100644 index 0000000..6ae03e8 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class StoragePresignedUrlCreateParamsTest { + + @Test + fun createStoragePresignedUrlCreateParams() { + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + } + + @Test + fun getQueryParams() { + val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } +} 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 new file mode 100644 index 0000000..c6dd2f5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt @@ -0,0 +1,25 @@ +// 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/services/blocking/StorageServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt new file mode 100644 index 0000000..5c66b4e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) class StorageServiceTest 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 new file mode 100644 index 0000000..558cb7c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.storage + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PresignedUrlServiceTest { + + @Test + fun callCreate() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlService = client.storage().presignedUrl() + val storagePresignedUrlCreateResponse = + presignedUrlService.create( + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + ) + println(storagePresignedUrlCreateResponse) + storagePresignedUrlCreateResponse.validate() + } +} From 6ce88ff0c6f47bc4ae9d64e97dfedccc98edc5f7 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 14 Aug 2024 12:38:32 +0000 Subject: [PATCH 13/21] chore(internal): refactor release doctor script (#19) --- .github/workflows/publish-sonatype.yml | 35 -------------- .github/workflows/release-doctor.yml | 26 ---------- .release-please-manifest.json | 3 -- bin/check-release-environment | 48 ------------------ build.gradle.kts | 2 +- release-please-config.json | 67 -------------------------- 6 files changed, 1 insertion(+), 180 deletions(-) delete mode 100644 .github/workflows/publish-sonatype.yml delete mode 100644 .github/workflows/release-doctor.yml delete mode 100644 .release-please-manifest.json delete mode 100644 bin/check-release-environment delete mode 100644 release-please-config.json diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml deleted file mode 100644 index 7535297..0000000 --- a/.github/workflows/publish-sonatype.yml +++ /dev/null @@ -1,35 +0,0 @@ -# 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: - -jobs: - publish: - name: publish - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Java - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: | - 8 - 17 - cache: gradle - - - name: Set up Gradle - uses: gradle/gradle-build-action@v2 - - - name: Publish to Sonatype - 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 }} \ No newline at end of file diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml deleted file mode 100644 index 6f68e09..0000000 --- a/.github/workflows/release-doctor.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Release Doctor -on: - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - release_doctor: - name: release doctor - 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: - - uses: actions/checkout@v4 - - - name: Check release environment - 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_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/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index ba6c348..0000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "0.1.0-alpha.1" -} \ No newline at end of file diff --git a/bin/check-release-environment b/bin/check-release-environment deleted file mode 100644 index 81d5c65..0000000 --- a/bin/check-release-environment +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -warnings=() -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 - warnings+=("The OPENLAYER_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") -fi - -if [ -z "${SONATYPE_PASSWORD}" ]; then - warnings+=("The OPENLAYER_SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") -fi - -if [ -z "${GPG_SIGNING_KEY}" ]; then - warnings+=("The OPENLAYER_SONATYPE_GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") -fi - -if [ -z "${GPG_SIGNING_PASSWORD}" ]; then - warnings+=("The OPENLAYER_SONATYPE_GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") -fi - -lenWarnings=${#warnings[@]} - -if [[ lenWarnings -gt 0 ]]; then - echo -e "Found the following warnings in the release environment:\n" - - for warning in "${warnings[@]}"; do - echo -e "- $warning\n" - done -fi - -lenErrors=${#errors[@]} - -if [[ lenErrors -gt 0 ]]; then - echo -e "Found the following errors in the release environment:\n" - - for error in "${errors[@]}"; do - echo -e "- $error\n" - done - - exit 1 -fi - -echo "The environment is ready to push releases!" diff --git a/build.gradle.kts b/build.gradle.kts index 1f51e8e..795fbd7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.openlayer.api" - version = "0.1.0-alpha.1" // x-release-please-version + version = "0.1.0-alpha.1" } nexusPublishing { diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 8f98719..0000000 --- a/release-please-config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "packages": { - ".": {} - }, - "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", - "include-v-in-tag": true, - "include-component-in-tag": false, - "versioning": "prerelease", - "prerelease": true, - "bump-minor-pre-major": true, - "bump-patch-for-minor-pre-major": false, - "pull-request-header": "Automated Release PR", - "pull-request-title-pattern": "release: ${version}", - "changelog-sections": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "perf", - "section": "Performance Improvements" - }, - { - "type": "revert", - "section": "Reverts" - }, - { - "type": "chore", - "section": "Chores" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "style", - "section": "Styles" - }, - { - "type": "refactor", - "section": "Refactors" - }, - { - "type": "test", - "section": "Tests", - "hidden": true - }, - { - "type": "build", - "section": "Build System" - }, - { - "type": "ci", - "section": "Continuous Integration", - "hidden": true - } - ], - "release-type": "simple", - "extra-files": [ - "README.md", - "build.gradle.kts" - ] -} \ No newline at end of file From b3df178a8dba68759f3e9146c32ab2b52afa07a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:19:57 +0000 Subject: [PATCH 14/21] feat(api): update via SDK Studio (#21) --- .../api/client/okhttp/OkHttpClient.kt | 19 +- .../client/okhttp/OpenlayerOkHttpClient.kt | 69 +- .../okhttp/OpenlayerOkHttpClientAsync.kt | 69 +- .../openlayer/api/client/OpenlayerClient.kt | 19 + .../api/client/OpenlayerClientAsync.kt | 19 + .../api/client/OpenlayerClientAsyncImpl.kt | 24 +- .../api/client/OpenlayerClientImpl.kt | 24 +- .../openlayer/api/core/BaseDeserializer.kt | 20 +- .../com/openlayer/api/core/ClientOptions.kt | 132 +- .../com/openlayer/api/core/Properties.kt | 11 +- .../com/openlayer/api/core/RequestOptions.kt | 4 +- .../kotlin/com/openlayer/api/core/Utils.kt | 8 +- .../kotlin/com/openlayer/api/core/Values.kt | 141 +- .../api/core/http/BinaryResponseContent.kt | 3 +- .../com/openlayer/api/core/http/HttpClient.kt | 2 +- .../openlayer/api/core/http/HttpRequest.kt | 1 + .../api/core/http/HttpRequestBody.kt | 7 +- .../api/core/http/RetryingHttpClient.kt | 165 +- .../api/errors/BadRequestException.kt | 5 +- .../api/errors/InternalServerException.kt | 7 +- .../openlayer/api/errors/NotFoundException.kt | 5 +- .../openlayer/api/errors/OpenlayerError.kt | 33 +- .../api/errors/OpenlayerServiceException.kt | 7 +- .../api/errors/PermissionDeniedException.kt | 5 +- .../api/errors/RateLimitException.kt | 5 +- .../api/errors/UnauthorizedException.kt | 5 +- .../errors/UnexpectedStatusCodeException.kt | 8 +- .../errors/UnprocessableEntityException.kt | 5 +- .../api/models/CommitTestResultListParams.kt | 312 +-- .../models/CommitTestResultListResponse.kt | 1262 ++++++------ .../InferencePipelineDataStreamParams.kt | 1712 ++++++++--------- .../InferencePipelineDataStreamResponse.kt | 113 +- .../InferencePipelineRowUpdateParams.kt | 385 ++-- .../InferencePipelineRowUpdateResponse.kt | 118 +- .../InferencePipelineTestResultListParams.kt | 306 +-- ...InferencePipelineTestResultListResponse.kt | 1266 ++++++------ .../api/models/ProjectCommitListParams.kt | 162 +- .../api/models/ProjectCommitListResponse.kt | 949 ++++----- .../api/models/ProjectCreateParams.kt | 625 +++--- .../api/models/ProjectCreateResponse.kt | 734 +++---- .../ProjectInferencePipelineCreateParams.kt | 337 ++-- .../ProjectInferencePipelineCreateResponse.kt | 434 +++-- .../ProjectInferencePipelineListParams.kt | 201 +- .../ProjectInferencePipelineListResponse.kt | 625 +++--- .../openlayer/api/models/ProjectListParams.kt | 220 ++- .../api/models/ProjectListResponse.kt | 939 +++++---- .../models/StoragePresignedUrlCreateParams.kt | 141 +- .../StoragePresignedUrlCreateResponse.kt | 136 +- .../com/openlayer/api/services/Handlers.kt | 48 +- .../api/services/HttpRequestBodies.kt | 35 +- .../api/services/async/CommitServiceAsync.kt | 34 + .../services/async/CommitServiceAsyncImpl.kt | 40 +- .../async/InferencePipelineServiceAsync.kt | 36 + .../InferencePipelineServiceAsyncImpl.kt | 40 +- .../api/services/async/ProjectServiceAsync.kt | 47 +- .../services/async/ProjectServiceAsyncImpl.kt | 145 +- .../api/services/async/StorageServiceAsync.kt | 34 + .../services/async/StorageServiceAsyncImpl.kt | 40 +- .../async/commits/TestResultServiceAsync.kt | 40 +- .../commits/TestResultServiceAsyncImpl.kt | 83 +- .../inferencePipelines/DataServiceAsync.kt | 40 +- .../DataServiceAsyncImpl.kt | 84 +- .../inferencePipelines/RowServiceAsync.kt | 40 +- .../inferencePipelines/RowServiceAsyncImpl.kt | 84 +- .../TestResultServiceAsync.kt | 40 +- .../TestResultServiceAsyncImpl.kt | 83 +- .../async/projects/CommitServiceAsync.kt | 40 +- .../async/projects/CommitServiceAsyncImpl.kt | 83 +- .../projects/InferencePipelineServiceAsync.kt | 45 +- .../InferencePipelineServiceAsyncImpl.kt | 135 +- .../async/storage/PresignedUrlServiceAsync.kt | 40 +- .../storage/PresignedUrlServiceAsyncImpl.kt | 86 +- .../api/services/blocking/CommitService.kt | 34 + .../services/blocking/CommitServiceImpl.kt | 36 +- .../blocking/InferencePipelineService.kt | 36 + .../blocking/InferencePipelineServiceImpl.kt | 36 +- .../api/services/blocking/ProjectService.kt | 46 +- .../services/blocking/ProjectServiceImpl.kt | 142 +- .../api/services/blocking/StorageService.kt | 34 + .../services/blocking/StorageServiceImpl.kt | 36 +- .../blocking/commits/TestResultService.kt | 39 +- .../blocking/commits/TestResultServiceImpl.kt | 81 +- .../inferencePipelines/DataService.kt | 39 +- .../inferencePipelines/DataServiceImpl.kt | 82 +- .../blocking/inferencePipelines/RowService.kt | 39 +- .../inferencePipelines/RowServiceImpl.kt | 82 +- .../inferencePipelines/TestResultService.kt | 39 +- .../TestResultServiceImpl.kt | 81 +- .../blocking/projects/CommitService.kt | 39 +- .../blocking/projects/CommitServiceImpl.kt | 81 +- .../projects/InferencePipelineService.kt | 44 +- .../projects/InferencePipelineServiceImpl.kt | 132 +- .../blocking/storage/PresignedUrlService.kt | 39 +- .../storage/PresignedUrlServiceImpl.kt | 84 +- .../com/openlayer/api/TestServerExtension.kt | 8 +- .../api/client/OpenlayerClientTest.kt | 4 + .../api/core/http/HttpRequestTest.kt | 18 +- .../api/core/http/RetryingHttpClientTest.kt | 69 +- .../openlayer/api/core/http/SerializerTest.kt | 38 +- .../models/CommitTestResultListParamsTest.kt | 90 +- .../CommitTestResultListResponseTest.kt | 255 ++- .../InferencePipelineDataStreamParamsTest.kt | 233 +-- ...InferencePipelineDataStreamResponseTest.kt | 22 +- .../InferencePipelineRowUpdateParamsTest.kt | 179 +- .../InferencePipelineRowUpdateResponseTest.kt | 22 +- ...ferencePipelineTestResultListParamsTest.kt | 90 +- ...rencePipelineTestResultListResponseTest.kt | 261 ++- .../api/models/ProjectCommitListParamsTest.kt | 72 +- .../models/ProjectCommitListResponseTest.kt | 202 +- .../api/models/ProjectCreateParamsTest.kt | 64 +- .../api/models/ProjectCreateResponseTest.kt | 159 +- ...rojectInferencePipelineCreateParamsTest.kt | 79 +- ...jectInferencePipelineCreateResponseTest.kt | 103 +- .../ProjectInferencePipelineListParamsTest.kt | 78 +- ...rojectInferencePipelineListResponseTest.kt | 140 +- .../api/models/ProjectListParamsTest.kt | 58 +- .../api/models/ProjectListResponseTest.kt | 198 +- .../StoragePresignedUrlCreateParamsTest.kt | 39 +- .../StoragePresignedUrlCreateResponseTest.kt | 31 +- .../api/services/ErrorHandlingTest.kt | 954 ++++----- .../api/services/ServiceParamsTest.kt | 155 +- .../services/blocking/CommitServiceTest.kt | 22 +- .../blocking/InferencePipelineServiceTest.kt | 22 +- .../services/blocking/ProjectServiceTest.kt | 77 +- .../services/blocking/StorageServiceTest.kt | 22 +- .../blocking/commits/TestResultServiceTest.kt | 53 +- .../inferencePipelines/DataServiceTest.kt | 87 +- .../inferencePipelines/RowServiceTest.kt | 62 +- .../TestResultServiceTest.kt | 51 +- .../blocking/projects/CommitServiceTest.kt | 47 +- .../projects/InferencePipelineServiceTest.kt | 77 +- .../storage/PresignedUrlServiceTest.kt | 41 +- 132 files changed, 10245 insertions(+), 8459 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 13779b0..841664d 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 @@ -4,27 +4,28 @@ import com.google.common.collect.ListMultimap import com.google.common.collect.MultimapBuilder import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpClient -import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpRequestBody import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.io.InputStream import java.net.Proxy import java.time.Duration import java.util.concurrent.CompletableFuture +import java.util.concurrent.TimeUnit import okhttp3.Call import okhttp3.Callback -import okhttp3.Headers import okhttp3.HttpUrl -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.MediaType -import okhttp3.MediaType.Companion.toMediaType +import okhttp3.Response import okhttp3.Request import okhttp3.RequestBody +import okhttp3.MediaType +import okhttp3.Headers +import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.Response import okio.BufferedSink class OkHttpClient @@ -33,8 +34,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient { val timeout = requestOptions.timeout ?: return okHttpClient - return okHttpClient - .newBuilder() + return okHttpClient.newBuilder() .connectTimeout(timeout) .readTimeout(timeout) .writeTimeout(timeout) @@ -76,8 +76,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val override fun onFailure(call: Call, e: IOException) { future.completeExceptionally(OpenlayerIoException("Request failed", e)) } - } - ) + }) return future } 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 1dff803..59c6cec 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 @@ -3,20 +3,25 @@ package com.openlayer.api.client.okhttp 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.google.common.collect.Multimap import java.net.Proxy import java.time.Clock import java.time.Duration +import java.util.Optional +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.OpenlayerClientImpl class OpenlayerOkHttpClient private constructor() { companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() - @JvmStatic fun fromEnv(): OpenlayerClient = builder().fromEnv().build() + @JvmStatic + fun fromEnv(): OpenlayerClient = builder().fromEnv().build() } class Builder { @@ -32,15 +37,21 @@ class OpenlayerOkHttpClient private constructor() { this.baseUrl = baseUrl } - fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } + fun jsonMapper(jsonMapper: JsonMapper) = apply { + clientOptions.jsonMapper(jsonMapper) + } - fun clock(clock: Clock) = apply { clientOptions.clock(clock) } + fun clock(clock: Clock) = apply { + clientOptions.clock(clock) + } fun headers(headers: Map>) = apply { clientOptions.headers(headers) } - fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) } + fun putHeader(name: String, value: String) = apply { + clientOptions.putHeader(name, value) + } fun putHeaders(name: String, values: Iterable) = apply { clientOptions.putHeaders(name, values) @@ -50,34 +61,42 @@ class OpenlayerOkHttpClient private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } + fun removeHeader(name: String) = apply { + clientOptions.removeHeader(name) + } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Duration) = apply { + this.timeout = timeout + } - fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } + fun maxRetries(maxRetries: Int) = apply { + clientOptions.maxRetries(maxRetries) + } - fun proxy(proxy: Proxy) = apply { this.proxy = proxy } + fun proxy(proxy: Proxy) = apply { + this.proxy = proxy + } fun responseValidation(responseValidation: Boolean) = apply { clientOptions.responseValidation(responseValidation) } - fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + fun apiKey(apiKey: String?) = apply { + clientOptions.apiKey(apiKey) + } - fun fromEnv() = apply { clientOptions.fromEnv() } + fun fromEnv() = apply { + clientOptions.fromEnv() + } fun build(): OpenlayerClient { - return OpenlayerClientImpl( - clientOptions - .httpClient( - OkHttpClient.builder() - .baseUrl(baseUrl) - .timeout(timeout) - .proxy(proxy) - .build() - ) - .build() - ) + return OpenlayerClientImpl(clientOptions + .httpClient(OkHttpClient.builder() + .baseUrl(baseUrl) + .timeout(timeout) + .proxy(proxy) + .build()) + .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 0866f95..ec87b53 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 @@ -3,20 +3,25 @@ package com.openlayer.api.client.okhttp 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.google.common.collect.Multimap import java.net.Proxy import java.time.Clock import java.time.Duration +import java.util.Optional +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.client.OpenlayerClientAsync +import com.openlayer.api.client.OpenlayerClientAsyncImpl class OpenlayerOkHttpClientAsync private constructor() { companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() - @JvmStatic fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() + @JvmStatic + fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() } class Builder { @@ -32,15 +37,21 @@ class OpenlayerOkHttpClientAsync private constructor() { this.baseUrl = baseUrl } - fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } + fun jsonMapper(jsonMapper: JsonMapper) = apply { + clientOptions.jsonMapper(jsonMapper) + } - fun clock(clock: Clock) = apply { clientOptions.clock(clock) } + fun clock(clock: Clock) = apply { + clientOptions.clock(clock) + } fun headers(headers: Map>) = apply { clientOptions.headers(headers) } - fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) } + fun putHeader(name: String, value: String) = apply { + clientOptions.putHeader(name, value) + } fun putHeaders(name: String, values: Iterable) = apply { clientOptions.putHeaders(name, values) @@ -50,34 +61,42 @@ class OpenlayerOkHttpClientAsync private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } + fun removeHeader(name: String) = apply { + clientOptions.removeHeader(name) + } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Duration) = apply { + this.timeout = timeout + } - fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } + fun maxRetries(maxRetries: Int) = apply { + clientOptions.maxRetries(maxRetries) + } - fun proxy(proxy: Proxy) = apply { this.proxy = proxy } + fun proxy(proxy: Proxy) = apply { + this.proxy = proxy + } fun responseValidation(responseValidation: Boolean) = apply { clientOptions.responseValidation(responseValidation) } - fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + fun apiKey(apiKey: String?) = apply { + clientOptions.apiKey(apiKey) + } - fun fromEnv() = apply { clientOptions.fromEnv() } + fun fromEnv() = apply { + clientOptions.fromEnv() + } fun build(): OpenlayerClientAsync { - return OpenlayerClientAsyncImpl( - clientOptions - .httpClient( - OkHttpClient.builder() - .baseUrl(baseUrl) - .timeout(timeout) - .proxy(proxy) - .build() - ) - .build() - ) + return OpenlayerClientAsyncImpl(clientOptions + .httpClient(OkHttpClient.builder() + .baseUrl(baseUrl) + .timeout(timeout) + .proxy(proxy) + .build()) + .build()) } } } 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 3a24286..95dd8b6 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 @@ -4,8 +4,27 @@ package com.openlayer.api.client +import java.time.Duration +import java.util.Base64 +import java.util.Optional +import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.JsonField +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface OpenlayerClient { 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 7d8847c..f233b6c 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 @@ -4,8 +4,27 @@ package com.openlayer.api.client +import java.time.Duration +import java.util.Base64 +import java.util.Optional +import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.JsonField +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.async.* +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface OpenlayerClientAsync { 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 d3c13ec..e53190b 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 @@ -2,17 +2,29 @@ package com.openlayer.api.client +import java.time.Duration +import java.util.Base64 +import java.util.Optional +import java.util.concurrent.CompletableFuture import com.openlayer.api.core.ClientOptions +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.JsonField +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.async.* +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler -class OpenlayerClientAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : OpenlayerClientAsync { +class OpenlayerClientAsyncImpl constructor(private val clientOptions: ClientOptions, ) : OpenlayerClientAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -22,9 +34,7 @@ constructor( private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - private val inferencePipelines: InferencePipelineServiceAsync by lazy { - InferencePipelineServiceAsyncImpl(clientOptions) - } + private val inferencePipelines: InferencePipelineServiceAsync by lazy { InferencePipelineServiceAsyncImpl(clientOptions) } private val storage: StorageServiceAsync by lazy { StorageServiceAsyncImpl(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 29a6187..2a97eb1 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 @@ -2,17 +2,29 @@ package com.openlayer.api.client +import java.time.Duration +import java.util.Base64 +import java.util.Optional +import java.util.concurrent.CompletableFuture import com.openlayer.api.core.ClientOptions +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.JsonField +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler -class OpenlayerClientImpl -constructor( - private val clientOptions: ClientOptions, -) : OpenlayerClient { +class OpenlayerClientImpl constructor(private val clientOptions: ClientOptions, ) : OpenlayerClient { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -22,9 +34,7 @@ constructor( private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - private val inferencePipelines: InferencePipelineService by lazy { - InferencePipelineServiceImpl(clientOptions) - } + private val inferencePipelines: InferencePipelineService by lazy { InferencePipelineServiceImpl(clientOptions) } private val storage: StorageService by lazy { StorageServiceImpl(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 0573e16..4a98458 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 @@ -13,13 +13,9 @@ import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer import kotlin.reflect.KClass -abstract class BaseDeserializer(type: KClass) : - StdDeserializer(type.java), ContextualDeserializer { +abstract class BaseDeserializer(type: KClass) : StdDeserializer(type.java), ContextualDeserializer { - override fun createContextual( - context: DeserializationContext, - property: BeanProperty? - ): JsonDeserializer { + override fun createContextual(context: DeserializationContext, property: BeanProperty?): JsonDeserializer { return this } @@ -29,11 +25,7 @@ abstract class BaseDeserializer(type: KClass) : protected abstract fun ObjectCodec.deserialize(node: JsonNode): T - protected fun ObjectCodec.tryDeserialize( - node: JsonNode, - type: TypeReference, - validate: (T) -> Unit = {} - ): T? { + protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: TypeReference, validate: (T) -> Unit = {}): T? { return try { readValue(treeAsTokens(node), type).apply(validate) } catch (e: JsonMappingException) { @@ -43,11 +35,7 @@ abstract class BaseDeserializer(type: KClass) : } } - protected fun ObjectCodec.tryDeserialize( - node: JsonNode, - type: JavaType, - validate: (T) -> Unit = {} - ): T? { + protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: JavaType, validate: (T) -> Unit = {}): T? { return try { readValue(treeAsTokens(node), type).apply(validate) } catch (e: JsonMappingException) { 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 ed353b4..b3082ae 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 @@ -3,31 +3,35 @@ package com.openlayer.api.core import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.Multimap import com.google.common.collect.ListMultimap +import com.google.common.collect.ArrayListMultimap +import java.time.Clock +import java.util.Base64 import com.openlayer.api.core.http.HttpClient import com.openlayer.api.core.http.RetryingHttpClient -import java.time.Clock -class ClientOptions -private constructor( - @get:JvmName("httpClient") val httpClient: HttpClient, - @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, - @get:JvmName("clock") val clock: Clock, - @get:JvmName("baseUrl") val baseUrl: String, - @get:JvmName("apiKey") val apiKey: String?, - @get:JvmName("headers") val headers: ListMultimap, - @get:JvmName("queryParams") val queryParams: ListMultimap, - @get:JvmName("responseValidation") val responseValidation: Boolean, +class ClientOptions private constructor( + @get:JvmName("httpClient") val httpClient: HttpClient, + @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, + @get:JvmName("clock") val clock: Clock, + @get:JvmName("baseUrl") val baseUrl: String, + @get:JvmName("apiKey") val apiKey: String?, + @get:JvmName("headers") val headers: ListMultimap, + @get:JvmName("queryParams") val queryParams: ListMultimap, + @get:JvmName("responseValidation") val responseValidation: Boolean, + ) { companion object { const val PRODUCTION_URL = "https://api.openlayer.com/v1" - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() - @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() + @JvmStatic + fun fromEnv(): ClientOptions = builder().fromEnv().build() } class Builder { @@ -42,13 +46,21 @@ private constructor( private var maxRetries: Int = 2 private var apiKey: String? = null - fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } + fun httpClient(httpClient: HttpClient) = apply { + this.httpClient = httpClient + } - fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } + fun jsonMapper(jsonMapper: JsonMapper) = apply { + this.jsonMapper = jsonMapper + } - fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } + fun baseUrl(baseUrl: String) = apply { + this.baseUrl = baseUrl + } - fun clock(clock: Clock) = apply { this.clock = clock } + fun clock(clock: Clock) = apply { + this.clock = clock + } fun headers(headers: Map>) = apply { this.headers.clear() @@ -67,7 +79,9 @@ private constructor( headers.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.headers.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.headers.put(name, mutableListOf()) + } fun queryParams(queryParams: Map>) = apply { this.queryParams.clear() @@ -86,49 +100,61 @@ private constructor( queryParams.forEach(this::putQueryParams) } - fun removeQueryParam(name: String) = apply { this.queryParams.put(name, mutableListOf()) } + fun removeQueryParam(name: String) = apply { + this.queryParams.put(name, mutableListOf()) + } fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } - fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } + fun maxRetries(maxRetries: Int) = apply { + this.maxRetries = maxRetries + } - fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } + fun apiKey(apiKey: String?) = apply { + this.apiKey = apiKey + } - fun fromEnv() = apply { System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } } + fun fromEnv() = apply { + System.getenv("OPENLAYER_API_KEY")?.let { + apiKey(it) + } + } fun build(): ClientOptions { - checkNotNull(httpClient) { "`httpClient` is required but was not set" } - - val headers = ArrayListMultimap.create() - val queryParams = ArrayListMultimap.create() - headers.put("X-Stainless-Lang", "java") - headers.put("X-Stainless-Arch", getOsArch()) - headers.put("X-Stainless-OS", getOsName()) - headers.put("X-Stainless-OS-Version", getOsVersion()) - headers.put("X-Stainless-Package-Version", getPackageVersion()) - headers.put("X-Stainless-Runtime-Version", getJavaVersion()) - if (!apiKey.isNullOrEmpty()) { - headers.put("Authorization", "Bearer ${apiKey}") - } - this.headers.forEach(headers::replaceValues) - this.queryParams.forEach(queryParams::replaceValues) - - return ClientOptions( - RetryingHttpClient.builder() - .httpClient(httpClient!!) - .clock(clock) - .maxRetries(maxRetries) - .build(), - jsonMapper ?: jsonMapper(), - clock, - baseUrl, - apiKey, - headers.toUnmodifiable(), - queryParams.toUnmodifiable(), - responseValidation, - ) + checkNotNull(httpClient) { + "`httpClient` is required but was not set" + } + + val headers = ArrayListMultimap.create() + val queryParams = ArrayListMultimap.create() + headers.put("X-Stainless-Lang", "java") + headers.put("X-Stainless-Arch", getOsArch()) + headers.put("X-Stainless-OS", getOsName()) + headers.put("X-Stainless-OS-Version", getOsVersion()) + headers.put("X-Stainless-Package-Version", getPackageVersion()) + headers.put("X-Stainless-Runtime-Version", getJavaVersion()) + if (!apiKey.isNullOrEmpty()) { + headers.put("Authorization", "Bearer ${apiKey}") + } + this.headers.forEach(headers::replaceValues) + this.queryParams.forEach(queryParams::replaceValues) + + return ClientOptions( + RetryingHttpClient.builder() + .httpClient(httpClient!!) + .clock(clock) + .maxRetries(maxRetries) + .build(), + jsonMapper ?: jsonMapper(), + clock, + baseUrl, + apiKey, + headers.toUnmodifiable(), + queryParams.toUnmodifiable(), + responseValidation, + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt index bc0d02a..505acea 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt @@ -9,12 +9,9 @@ fun getOsArch(): String { return when (osArch) { null -> "unknown" - "i386", - "x32", - "x86" -> "x32" - "amd64", - "x86_64" -> "x64" - "arm" -> "arm" + "i386", "x32", "x86" -> "x32" + "amd64", "x86_64" -> "x64" + "arm"-> "arm" "aarch64" -> "arm64" else -> "other:${osArch}" } @@ -39,7 +36,7 @@ fun getOsVersion(): String { } fun getPackageVersion(): String { - return Properties::class.java.`package`.implementationVersion ?: "unknown" + return Properties::class.java.`package`.implementationVersion ?: "unknown"; } fun getJavaVersion(): String { 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 2b862a3..0752435 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 @@ -31,7 +31,9 @@ private constructor( this.responseValidation = responseValidation } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Duration) = apply { + this.timeout = timeout + } fun build(): RequestOptions { return RequestOptions(responseValidation, timeout) 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 8f46e25..311b40e 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 @@ -48,10 +48,10 @@ internal fun ListMultimap.toUnmodifiable(): ListMultimap { internal fun ListMultimap.getRequiredHeader(header: String): String { val value = entries() - .stream() - .filter { entry -> entry.key.equals(header, ignoreCase = true) } - .map { entry -> entry.value } - .findFirst() + .stream() + .filter { entry -> entry.key.equals(header, ignoreCase = true) } + .map { entry -> entry.value } + .findFirst() if (!value.isPresent) { throw OpenlayerInvalidDataException("Could not find $header header") } 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 12b454f..826a2c8 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 @@ -6,6 +6,7 @@ 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 +import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.BeanProperty @@ -16,6 +17,8 @@ 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.databind.deser.ContextualDeserializer +import com.fasterxml.jackson.databind.deser.std.StdDeserializer import com.fasterxml.jackson.databind.node.JsonNodeType.ARRAY import com.fasterxml.jackson.databind.node.JsonNodeType.BINARY import com.fasterxml.jackson.databind.node.JsonNodeType.BOOLEAN @@ -26,14 +29,15 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.OBJECT 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.util.Objects import java.util.Optional +import java.util.Objects +import java.io.ByteArrayOutputStream import org.apache.hc.core5.http.ContentType +import java.nio.charset.Charset +import com.openlayer.api.errors.OpenlayerInvalidDataException @JsonDeserialize(using = JsonField.Deserializer::class) -sealed class JsonField { +sealed class JsonField { fun isMissing(): Boolean = this is JsonMissing @@ -46,9 +50,9 @@ sealed class JsonField { } /** - * 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`. + * 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`. */ fun asUnknown(): Optional = when (this) { @@ -123,12 +127,13 @@ sealed class JsonField { is JsonValue -> accept(visitor as JsonValue.Visitor) } - interface Visitor : JsonValue.Visitor { + interface Visitor: JsonValue.Visitor { fun visitKnown(value: T): R = visitDefault() } companion object { - @JvmStatic fun of(value: T): JsonField = KnownValue.of(value) + @JvmStatic + fun of(value: T): JsonField = KnownValue.of(value) @JvmStatic fun ofNullable(value: T?): JsonField = @@ -155,8 +160,11 @@ sealed class JsonField { } override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> { - return type?.let { tryDeserialize(node, type) }?.let { of(it) } - ?: JsonValue.fromJsonNode(node) + return type?.let { + tryDeserialize(node, type) + }?.let { + of(it) + } ?: JsonValue.fromJsonNode(node) } override fun getNullValue(context: DeserializationContext): JsonField<*> { @@ -166,11 +174,11 @@ sealed class JsonField { } @JsonDeserialize(using = JsonValue.Deserializer::class) -sealed class JsonValue : JsonField() { +sealed class JsonValue: JsonField() { - fun convert(type: TypeReference): R? = JSON_MAPPER.convertValue(this, type) + fun convert(type: TypeReference): R? = JSON_MAPPER.convertValue(this, type) - fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) + fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) fun accept(visitor: Visitor): R = when (this) { @@ -185,19 +193,12 @@ sealed class JsonValue : JsonField() { interface Visitor { fun visitNull(): R = visitDefault() - fun visitMissing(): R = visitDefault() - fun visitBoolean(value: Boolean): R = visitDefault() - fun visitNumber(value: Number): R = visitDefault() - fun visitString(value: String): R = visitDefault() - fun visitArray(values: List): R = visitDefault() - fun visitObject(values: Map): R = visitDefault() - fun visitDefault(): R { throw RuntimeException("Unexpected value") } @@ -223,12 +224,8 @@ sealed class JsonValue : JsonField() { BOOLEAN -> JsonBoolean.of(node.booleanValue()) NUMBER -> JsonNumber.of(node.numberValue()) STRING -> JsonString.of(node.textValue()) - ARRAY -> - JsonArray.of(node.elements().asSequence().map { fromJsonNode(it) }.toList()) - OBJECT -> - JsonObject.of( - node.fields().asSequence().map { it.key to fromJsonNode(it.value) }.toMap() - ) + ARRAY -> JsonArray.of(node.elements().asSequence().map { fromJsonNode(it) }.toList()) + OBJECT -> JsonObject.of(node.fields().asSequence().map { it.key to fromJsonNode(it.value) }.toMap()) BINARY, POJO, null -> throw IllegalStateException("Unexpected JsonNode type: ${node.nodeType}") @@ -246,10 +243,7 @@ sealed class JsonValue : JsonField() { } } -class KnownValue -private constructor( - @com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T -) : JsonField() { +class KnownValue private constructor(@com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T) : JsonField() { override fun equals(other: Any?): Boolean { if (this === other) { @@ -264,7 +258,7 @@ private constructor( override fun toString() = value.toString() companion object { - @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) + @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) } } @@ -279,14 +273,11 @@ class JsonMissing : JsonValue() { @JvmStatic fun of() = INSTANCE } - class Serializer : BaseSerializer(JsonMissing::class) { - override fun serialize( - value: JsonMissing, - generator: JsonGenerator, - provider: SerializerProvider - ) { + class Serializer: BaseSerializer(JsonMissing::class) { + override fun serialize(value: JsonMissing, generator: JsonGenerator, provider: SerializerProvider) { throw RuntimeException("JsonMissing cannot be serialized") } + } } @@ -387,7 +378,9 @@ private constructor( override fun toString() = values.toString() companion object { - @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toUnmodifiable()) + @JsonCreator + @JvmStatic + fun of(values: List) = JsonArray(values.toUnmodifiable()) } } @@ -424,18 +417,18 @@ private constructor( ) annotation class ExcludeMissing + @JacksonAnnotationsInside @JsonAutoDetect( getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE -) + fieldVisibility = Visibility.NONE) annotation class NoAutoDetect -class MultipartFormValue -internal constructor( + +class MultipartFormValue internal constructor( val name: String, val value: T, val contentType: ContentType, @@ -446,20 +439,16 @@ internal constructor( 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() - } - ) + 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 } @@ -470,8 +459,7 @@ internal constructor( other as MultipartFormValue<*> - if (name != other.name || contentType != other.contentType || filename != other.filename) - return false + if (name != other.name || contentType != other.contentType || filename != other.filename) return false return when { value is ByteArray && other.value is ByteArray -> value contentEquals other.value @@ -483,11 +471,10 @@ internal constructor( return "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() - } + private fun valueToString(): String = when (value) { + is ByteArray -> "ByteArray of size ${value.size}" + else -> value.toString() + } companion object { internal fun fromString( @@ -497,27 +484,27 @@ internal constructor( ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromBoolean( - name: String, - value: Boolean, - contentType: ContentType, + name: String, + value: Boolean, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromLong( - name: String, - value: Long, - contentType: ContentType, + name: String, + value: Long, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromDouble( - name: String, - value: Double, - contentType: ContentType, + name: String, + value: Double, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) - internal fun fromEnum( - name: String, - value: T, - contentType: ContentType + internal fun fromEnum( + name: String, + value: T, + contentType: ContentType ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromByteArray( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt index 4c099ff..a324305 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt @@ -1,8 +1,9 @@ package com.openlayer.api.core.http +import com.google.common.collect.ListMultimap import java.io.Closeable -import java.io.IOException import java.io.InputStream +import java.io.IOException import java.io.OutputStream interface BinaryResponseContent : Closeable { 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 b9cac17..f492388 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,8 +1,8 @@ package com.openlayer.api.core.http -import com.openlayer.api.core.RequestOptions import java.io.Closeable import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.RequestOptions interface HttpClient : Closeable { 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 243c19a..53d1d41 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 @@ -5,6 +5,7 @@ import com.google.common.collect.ListMultimap import com.google.common.collect.Multimap import com.google.common.collect.MultimapBuilder import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.RequestOptions class HttpRequest private constructor( 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 4f4dbd1..402d902 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 @@ -13,11 +13,10 @@ interface HttpRequestBody : Closeable { fun contentLength(): Long /** - * Determines if a request can be repeated in a meaningful way, for example before doing a - * retry. + * Determines if a request can be repeated in a meaningful way, for example before doing a retry. * - * The most typical case when a request can't be retried is if the request body is being - * streamed. In this case the body data isn't available on subsequent attempts. + * The most typical case when a request can't be retried is if the request body is being streamed. In this case the + * body data isn't available on subsequent attempts. */ fun repeatable(): Boolean 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 a90d6f4..f870b89 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 @@ -3,8 +3,8 @@ package com.openlayer.api.core.http import com.google.common.util.concurrent.MoreExecutors -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerIoException +import com.openlayer.api.core.RequestOptions import java.io.IOException import java.time.Clock import java.time.Duration @@ -24,15 +24,15 @@ import kotlin.math.pow class RetryingHttpClient private constructor( - private val httpClient: HttpClient, - private val clock: Clock, - private val maxRetries: Int, - private val idempotencyHeader: String?, + private val httpClient: HttpClient, + private val clock: Clock, + private val maxRetries: Int, + private val idempotencyHeader: String?, ) : HttpClient { override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, + request: HttpRequest, + requestOptions: RequestOptions, ): HttpResponse { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.execute(request, requestOptions) @@ -44,20 +44,20 @@ private constructor( while (true) { val response = - try { - val response = httpClient.execute(request, requestOptions) - if (++retries > maxRetries || !shouldRetry(response)) { - return response - } + try { + val response = httpClient.execute(request, requestOptions) + if (++retries > maxRetries || !shouldRetry(response)) { + return response + } - response - } catch (t: Throwable) { - if (++retries > maxRetries || !shouldRetry(t)) { - throw t - } + response + } catch (t: Throwable) { + if (++retries > maxRetries || !shouldRetry(t)) { + throw t + } - null - } + null + } val backoffMillis = getRetryBackoffMillis(retries, response) Thread.sleep(backoffMillis.toMillis()) @@ -65,8 +65,8 @@ private constructor( } override fun executeAsync( - request: HttpRequest, - requestOptions: RequestOptions, + request: HttpRequest, + requestOptions: RequestOptions, ): CompletableFuture { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.executeAsync(request, requestOptions) @@ -78,31 +78,31 @@ private constructor( fun wrap(future: CompletableFuture): CompletableFuture { return future - .handleAsync( - fun( - response: HttpResponse?, - throwable: Throwable? - ): CompletableFuture { - if (response != null) { - if (++retries > maxRetries || !shouldRetry(response)) { - return CompletableFuture.completedFuture(response) - } - } else { - if (++retries > maxRetries || !shouldRetry(throwable!!)) { - val failedFuture = CompletableFuture() - failedFuture.completeExceptionally(throwable) - return failedFuture - } - } - - val backoffMillis = getRetryBackoffMillis(retries, response) - return sleepAsync(backoffMillis.toMillis()).thenCompose { - wrap(httpClient.executeAsync(request, requestOptions)) - } - }, - MoreExecutors.directExecutor() - ) - .thenCompose(Function.identity()) + .handleAsync( + fun( + response: HttpResponse?, + throwable: Throwable? + ): CompletableFuture { + if (response != null) { + if (++retries > maxRetries || !shouldRetry(response)) { + return CompletableFuture.completedFuture(response) + } + } else { + if (++retries > maxRetries || !shouldRetry(throwable!!)) { + val failedFuture = CompletableFuture() + failedFuture.completeExceptionally(throwable) + return failedFuture + } + } + + val backoffMillis = getRetryBackoffMillis(retries, response) + return sleepAsync(backoffMillis.toMillis()).thenCompose { + wrap(httpClient.executeAsync(request, requestOptions)) + } + }, + MoreExecutors.directExecutor() + ) + .thenCompose(Function.identity()) } return wrap(httpClient.executeAsync(request, requestOptions)) @@ -158,38 +158,30 @@ private constructor( private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration { // About the Retry-After header: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After - response - ?.headers() - ?.let { headers -> - headers - .get("Retry-After-Ms") - .getOrNull(0) - ?.toFloatOrNull() - ?.times(TimeUnit.MILLISECONDS.toNanos(1)) + response?.headers()?.let { headers -> + headers.get("Retry-After-Ms").getOrNull(0)?.toFloatOrNull()?.times(TimeUnit.MILLISECONDS.toNanos(1)) ?: headers.get("Retry-After").getOrNull(0)?.let { retryAfter -> retryAfter.toFloatOrNull()?.times(TimeUnit.SECONDS.toNanos(1)) - ?: try { - ChronoUnit.MILLIS.between( - OffsetDateTime.now(clock), - OffsetDateTime.parse( - retryAfter, - DateTimeFormatter.RFC_1123_DATE_TIME + ?: try { + ChronoUnit.MILLIS.between( + OffsetDateTime.now(clock), + OffsetDateTime.parse( + retryAfter, + DateTimeFormatter.RFC_1123_DATE_TIME + ) ) - ) - } catch (e: DateTimeParseException) { - null - } + } catch (e: DateTimeParseException) { + null + } } + }?.let { retryAfterNanos -> + // If the API asks us to wait a certain amount of time (and it's a reasonable amount), just + // do what it says. + val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) + if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { + return retryAfter } - ?.let { retryAfterNanos -> - // If the API asks us to wait a certain amount of time (and it's a reasonable - // amount), just - // do what it says. - val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) - if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { - return retryAfter - } - } + } // Apply exponential backoff, but not more than the max. val backoffSeconds = min(0.5 * 2.0.pow(retries - 1), 8.0) @@ -203,12 +195,12 @@ private constructor( private fun sleepAsync(millis: Long): CompletableFuture { val future = CompletableFuture() TIMER.schedule( - object : TimerTask() { - override fun run() { - future.complete(null) - } - }, - millis + object : TimerTask() { + override fun run() { + future.complete(null) + } + }, + millis ) return future } @@ -217,7 +209,8 @@ private constructor( private val TIMER = Timer("RetryingHttpClient", true) - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -236,11 +229,11 @@ private constructor( fun idempotencyHeader(header: String) = apply { this.idempotencyHeader = header } fun build(): HttpClient = - RetryingHttpClient( - checkNotNull(httpClient) { "`httpClient` is required but was not set" }, - clock, - maxRetries, - idempotencyHeader, - ) + RetryingHttpClient( + checkNotNull(httpClient) { "`httpClient` is required but was not set" }, + clock, + maxRetries, + idempotencyHeader, + ) } } 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 f51b5d2..c82ec23 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 @@ -4,10 +4,9 @@ import com.google.common.collect.ListMultimap class BadRequestException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 400 - fun error(): OpenlayerError = error } 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 b0c6a67..4108a62 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 @@ -4,11 +4,10 @@ import com.google.common.collect.ListMultimap class InternalServerException constructor( - private val statusCode: Int, - headers: ListMultimap, - private val error: OpenlayerError, + private val statusCode: Int, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = statusCode - fun error(): OpenlayerError = 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 9efe856..f5dd8ce 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 @@ -4,10 +4,9 @@ import com.google.common.collect.ListMultimap class NotFoundException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 404 - fun error(): OpenlayerError = 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 59250fe..11051a8 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 @@ -5,46 +5,51 @@ 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 java.time.LocalDate +import java.time.OffsetDateTime +import java.util.Objects +import java.util.UUID +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import java.util.Objects @JsonDeserialize(builder = OpenlayerError.Builder::class) @NoAutoDetect -class OpenlayerError -constructor( - private val additionalProperties: Map, -) { +class OpenlayerError constructor(private val additionalProperties: Map, ) { - @JsonAnyGetter fun additionalProperties(): Map = additionalProperties + @JsonAnyGetter + fun additionalProperties(): Map = additionalProperties fun toBuilder() = Builder() override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is OpenlayerError && this.additionalProperties == other.additionalProperties + return other is OpenlayerError && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - return Objects.hash(additionalProperties) + return Objects.hash(additionalProperties) } override fun toString() = "OpenlayerError{additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { private var additionalProperties: MutableMap = mutableMapOf() - fun from(error: OpenlayerError) = apply { additionalProperties(error.additionalProperties) } + fun from(error: OpenlayerError) = apply { + additionalProperties(error.additionalProperties) + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() 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 916e4ed..2f9b4b4 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 @@ -5,11 +5,10 @@ import com.google.common.collect.ListMultimap abstract class OpenlayerServiceException @JvmOverloads constructor( - private val headers: ListMultimap, - message: String? = null, - cause: Throwable? = null + private val headers: ListMultimap, + message: String? = null, + cause: Throwable? = null ) : OpenlayerException(message, cause) { abstract fun statusCode(): Int - fun headers(): ListMultimap = headers } 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 cc7f0d6..511df28 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 @@ -4,10 +4,9 @@ import com.google.common.collect.ListMultimap class PermissionDeniedException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 403 - fun error(): OpenlayerError = 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 5b83fd0..c930e91 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 @@ -4,10 +4,9 @@ import com.google.common.collect.ListMultimap class RateLimitException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 429 - fun error(): OpenlayerError = 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 f0e8f0f..699feed 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 @@ -4,10 +4,9 @@ import com.google.common.collect.ListMultimap class UnauthorizedException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 401 - fun error(): OpenlayerError = error } 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 30e8d3a..f0cef5c 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 @@ -3,12 +3,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap class UnexpectedStatusCodeException -constructor( - private val statusCode: Int, - headers: ListMultimap, - private val body: String -) : OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { +constructor(private val statusCode: Int, headers: ListMultimap, private val body: String) : + OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { override fun statusCode(): Int = statusCode - fun body() = body } 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 87dba98..992665e 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 @@ -4,10 +4,9 @@ import com.google.common.collect.ListMultimap class UnprocessableEntityException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 422 - fun error(): OpenlayerError = 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 6b1c3e4..e27c81a 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 @@ -2,28 +2,51 @@ 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.openlayer.api.core.Enum +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow +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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class CommitTestResultListParams -constructor( - private val projectVersionId: String, - private val includeArchived: Boolean?, - private val page: Long?, - private val perPage: Long?, - private val status: Status?, - private val type: Type?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class CommitTestResultListParams constructor( + private val projectVersionId: String, + private val includeArchived: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun projectVersionId(): String = projectVersionId @@ -40,23 +63,34 @@ constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.includeArchived?.let { params.put("includeArchived", listOf(it.toString())) } - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - this.status?.let { params.put("status", listOf(it.toString())) } - this.type?.let { params.put("type", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.includeArchived?.let { + params.put("includeArchived", listOf(it.toString())) + } + this.page?.let { + params.put("page", listOf(it.toString())) + } + this.perPage?.let { + params.put("perPage", listOf(it.toString())) + } + this.status?.let { + params.put("status", listOf(it.toString())) + } + this.type?.let { + params.put("type", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectVersionId - else -> "" - } + return when (index) { + 0 -> projectVersionId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -66,44 +100,44 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListParams && - this.projectVersionId == other.projectVersionId && - this.includeArchived == other.includeArchived && - this.page == other.page && - this.perPage == other.perPage && - this.status == other.status && - this.type == other.type && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is CommitTestResultListParams && + this.projectVersionId == other.projectVersionId && + this.includeArchived == other.includeArchived && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectVersionId, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectVersionId, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -142,22 +176,30 @@ 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 + } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long) = apply { + this.perPage = perPage + } /** - * Filter list of test results by status. Available statuses are `running`, `passing`, - * `failing`, `skipped`, and `error`. + * 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: Status) = apply { + this.status = status + } /** * 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: Type) = apply { + this.type = type + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -197,7 +239,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -208,39 +252,37 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): CommitTestResultListParams = - CommitTestResultListParams( - checkNotNull(projectVersionId) { "`projectVersionId` is required but was not set" }, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): CommitTestResultListParams = CommitTestResultListParams( + checkNotNull(projectVersionId) { + "`projectVersionId` is required but was not set" + }, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -279,43 +321,39 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun value(): Value = when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Type && this.value == other.value + return other is Type && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -354,25 +392,23 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - INTEGRITY -> Value.INTEGRITY - CONSISTENCY -> Value.CONSISTENCY - PERFORMANCE -> Value.PERFORMANCE - FAIRNESS -> Value.FAIRNESS - ROBUSTNESS -> Value.ROBUSTNESS - else -> Value._UNKNOWN - } - - 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") - } + fun value(): Value = when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 731f3b5..d708086 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 @@ -5,37 +5,37 @@ 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.JsonIgnoreProperties 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.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.Enum +import com.openlayer.api.core.getOrThrow 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.getOrThrow +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect 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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { +class CommitTestResultListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -45,9 +45,13 @@ private constructor( fun items(): List = items.getRequired("items") - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + @JsonProperty("_meta") + @ExcludeMissing + fun __meta() = _meta - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") + @ExcludeMissing + fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -55,43 +59,42 @@ private constructor( fun validate(): CommitTestResultListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is CommitTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -111,13 +114,17 @@ private constructor( @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun _meta(_meta: JsonField<_Meta>) = apply { + this._meta = _meta + } 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 + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -133,23 +140,22 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): CommitTestResultListResponse = - CommitTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): CommitTestResultListResponse = CommitTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, + class _Meta private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -169,16 +175,24 @@ private constructor( fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page + @JsonProperty("page") + @ExcludeMissing + fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + @JsonProperty("perPage") + @ExcludeMissing + fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + @JsonProperty("totalItems") + @ExcludeMissing + fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + @JsonProperty("totalPages") + @ExcludeMissing + fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -186,49 +200,48 @@ private constructor( fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -254,7 +267,9 @@ private constructor( /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } + fun page(page: JsonField) = apply { + this.page = page + } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -262,7 +277,9 @@ private constructor( /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + fun perPage(perPage: JsonField) = apply { + this.perPage = perPage + } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -270,7 +287,9 @@ private constructor( /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + fun totalItems(totalItems: JsonField) = apply { + this.totalItems = totalItems + } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -278,7 +297,9 @@ private constructor( /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + fun totalPages(totalPages: JsonField) = apply { + this.totalPages = totalPages + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -294,33 +315,32 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item - 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, + class Item 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, + ) { private var validated: Boolean = false @@ -336,12 +356,10 @@ private constructor( fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) /** The project version (commit) id. */ - fun projectVersionId(): Optional = - Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = - Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -350,30 +368,35 @@ private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The data start date. */ - fun dateDataStarts(): Optional = - Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) /** The data end date. */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) /** The status of the test. */ fun status(): Status = status.getRequired("status") /** The status message. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** Project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id - @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + @JsonProperty("goal") + @ExcludeMissing + fun _goal() = goal /** The test id. */ - @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + @JsonProperty("goalId") + @ExcludeMissing + fun _goalId() = goalId /** The project version (commit) id. */ - @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + @JsonProperty("projectVersionId") + @ExcludeMissing + fun _projectVersionId() = projectVersionId /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -381,22 +404,34 @@ private constructor( fun _inferencePipelineId() = inferencePipelineId /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The data start date. */ - @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun _dateDataStarts() = dateDataStarts /** The data end date. */ - @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun _dateDataEnds() = dateDataEnds /** The status of the test. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") + @ExcludeMissing + fun _status() = status /** The status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage() = statusMessage @JsonAnyGetter @ExcludeMissing @@ -404,70 +439,69 @@ private constructor( fun validate(): Item = apply { if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -507,13 +541,17 @@ private constructor( /** Project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + 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 } + fun goal(goal: JsonField) = apply { + this.goal = goal + } /** The test id. */ fun goalId(goalId: String) = goalId(JsonField.of(goalId)) @@ -521,11 +559,12 @@ private constructor( /** The test id. */ @JsonProperty("goalId") @ExcludeMissing - fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + fun goalId(goalId: JsonField) = apply { + this.goalId = goalId + } /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = - projectVersionId(JsonField.of(projectVersionId)) + fun projectVersionId(projectVersionId: String) = projectVersionId(JsonField.of(projectVersionId)) /** The project version (commit) id. */ @JsonProperty("projectVersionId") @@ -535,8 +574,7 @@ private constructor( } /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = - inferencePipelineId(JsonField.of(inferencePipelineId)) + fun inferencePipelineId(inferencePipelineId: String) = inferencePipelineId(JsonField.of(inferencePipelineId)) /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -566,8 +604,7 @@ private constructor( } /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = - dateDataStarts(JsonField.of(dateDataStarts)) + fun dateDataStarts(dateDataStarts: OffsetDateTime) = dateDataStarts(JsonField.of(dateDataStarts)) /** The data start date. */ @JsonProperty("dateDataStarts") @@ -577,8 +614,7 @@ private constructor( } /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = - dateDataEnds(JsonField.of(dateDataEnds)) + fun dateDataEnds(dateDataEnds: OffsetDateTime) = dateDataEnds(JsonField.of(dateDataEnds)) /** The data end date. */ @JsonProperty("dateDataEnds") @@ -593,7 +629,9 @@ private constructor( /** The status of the test. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + fun status(status: JsonField) = apply { + this.status = status + } /** The status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -619,37 +657,34 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = - Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -688,56 +723,54 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun known(): Known = when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = Goal.Builder::class) @NoAutoDetect - class Goal - 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, + class Goal 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, + ) { private var validated: Boolean = false @@ -759,13 +792,14 @@ 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 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")) + fun delayWindow(): Optional = Optional.ofNullable(delayWindow.getNullable("delayWindow")) /** The test type. */ fun type(): String = type.getRequired("type") @@ -774,22 +808,18 @@ private constructor( fun subtype(): String = subtype.getRequired("subtype") /** The test creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(): Optional = - Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) fun thresholds(): List = thresholds.getRequired("thresholds") /** Whether the test is archived. */ - fun archived(): Optional = - Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) /** The date the test was archived. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** Whether the test is suggested or user-created. */ fun suggested(): Boolean = suggested.getRequired("suggested") @@ -798,81 +828,111 @@ private constructor( fun commentCount(): Long = commentCount.getRequired("commentCount") /** Whether the test uses an ML model. */ - fun usesMlModel(): Optional = - Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = - Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = - Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(): Optional = - Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + 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")) + fun usesProductionData(): Optional = Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** The test id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The test number. */ - @JsonProperty("number") @ExcludeMissing fun _number() = number + @JsonProperty("number") + @ExcludeMissing + fun _number() = number /** The test name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The test description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("description") + @ExcludeMissing + fun _description() = description - /** 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. + */ @JsonProperty("evaluationWindow") @ExcludeMissing fun _evaluationWindow() = evaluationWindow /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + @JsonProperty("delayWindow") + @ExcludeMissing + fun _delayWindow() = delayWindow /** The test type. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonProperty("type") + @ExcludeMissing + fun _type() = type /** The test subtype. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + @JsonProperty("subtype") + @ExcludeMissing + fun _subtype() = subtype /** The test creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId() = creatorId /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @ExcludeMissing fun _originProjectVersionId() = originProjectVersionId - @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + @JsonProperty("thresholds") + @ExcludeMissing + fun _thresholds() = thresholds /** Whether the test is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + @JsonProperty("archived") + @ExcludeMissing + fun _archived() = archived /** The date the test was archived. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived() = dateArchived /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested + @JsonProperty("suggested") + @ExcludeMissing + fun _suggested() = suggested /** The number of comments on the test. */ - @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount() = commentCount /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel + @JsonProperty("usesMlModel") + @ExcludeMissing + fun _usesMlModel() = usesMlModel /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -900,102 +960,101 @@ private constructor( 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 + 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 } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - 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, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = 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, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1057,7 +1116,9 @@ private constructor( /** The test id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { + this.id = id + } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) @@ -1065,7 +1126,9 @@ private constructor( /** The test number. */ @JsonProperty("number") @ExcludeMissing - fun number(number: JsonField) = apply { this.number = number } + fun number(number: JsonField) = apply { + this.number = number + } /** The test name. */ fun name(name: String) = name(JsonField.of(name)) @@ -1073,11 +1136,12 @@ private constructor( /** The test name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun name(name: JsonField) = apply { + this.name = name + } /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = - dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The creation date. */ @JsonProperty("dateCreated") @@ -1087,8 +1151,7 @@ private constructor( } /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = - dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ @JsonProperty("dateUpdated") @@ -1100,16 +1163,19 @@ private constructor( /** The test description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonValue) = apply { this.description = description } + fun description(description: JsonValue) = apply { + this.description = description + } /** - * 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. */ - fun evaluationWindow(evaluationWindow: Double) = - evaluationWindow(JsonField.of(evaluationWindow)) + fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(JsonField.of(evaluationWindow)) /** - * 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. */ @JsonProperty("evaluationWindow") @ExcludeMissing @@ -1133,7 +1199,9 @@ private constructor( /** The test type. */ @JsonProperty("type") @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonField) = apply { + this.type = type + } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) @@ -1141,7 +1209,9 @@ private constructor( /** The test subtype. */ @JsonProperty("subtype") @ExcludeMissing - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun subtype(subtype: JsonField) = apply { + this.subtype = subtype + } /** The test creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -1149,11 +1219,12 @@ private constructor( /** The test creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + 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)) + fun originProjectVersionId(originProjectVersionId: String) = originProjectVersionId(JsonField.of(originProjectVersionId)) /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @@ -1176,11 +1247,12 @@ private constructor( /** Whether the test is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { this.archived = archived } + fun archived(archived: JsonField) = apply { + this.archived = archived + } /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = - dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) /** The date the test was archived. */ @JsonProperty("dateArchived") @@ -1195,7 +1267,9 @@ private constructor( /** Whether the test is suggested or user-created. */ @JsonProperty("suggested") @ExcludeMissing - fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + fun suggested(suggested: JsonField) = apply { + this.suggested = suggested + } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) @@ -1218,8 +1292,7 @@ private constructor( } /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = - usesValidationDataset(JsonField.of(usesValidationDataset)) + fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -1229,8 +1302,7 @@ private constructor( } /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = - usesTrainingDataset(JsonField.of(usesTrainingDataset)) + fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) /** Whether the test uses a training dataset. */ @JsonProperty("usesTrainingDataset") @@ -1240,8 +1312,7 @@ private constructor( } /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = - usesReferenceDataset(JsonField.of(usesReferenceDataset)) + fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @@ -1251,8 +1322,7 @@ private constructor( } /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = - usesProductionData(JsonField.of(usesProductionData)) + fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) /** Whether the test uses production data (monitoring mode only). */ @JsonProperty("usesProductionData") @@ -1271,49 +1341,47 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Goal = - Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties.toUnmodifiable(), - ) + fun build(): Goal = Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Threshold.Builder::class) @NoAutoDetect - class Threshold - 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, + class Threshold 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, + ) { private var validated: Boolean = false @@ -1321,38 +1389,42 @@ private constructor( private var hashCode: Int = 0 /** The measurement to be evaluated. */ - fun measurement(): Optional = - Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) /** The insight name to be evaluated. */ - fun insightName(): Optional = - Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) - fun insightParameters(): Optional> = - Optional.ofNullable(insightParameters.getNullable("insightParameters")) + fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) /** The operator to be used for the evaluation. */ - fun operator(): Optional = - Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) /** The value to be compared. */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) /** The measurement to be evaluated. */ - @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement() = measurement /** The insight name to be evaluated. */ - @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName() = insightName @JsonProperty("insightParameters") @ExcludeMissing fun _insightParameters() = insightParameters /** The operator to be used for the evaluation. */ - @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + @JsonProperty("operator") + @ExcludeMissing + fun _operator() = operator /** The value to be compared. */ - @JsonProperty("value") @ExcludeMissing fun _value() = value + @JsonProperty("value") + @ExcludeMissing + fun _value() = value @JsonAnyGetter @ExcludeMissing @@ -1360,52 +1432,51 @@ private constructor( fun validate(): Threshold = apply { if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + measurement() + insightName() + insightParameters() + operator() + value() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + override fun toString() = "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1447,8 +1518,7 @@ private constructor( this.insightName = insightName } - fun insightParameters(insightParameters: List) = - insightParameters(JsonField.of(insightParameters)) + fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) @JsonProperty("insightParameters") @ExcludeMissing @@ -1462,7 +1532,9 @@ private constructor( /** The operator to be used for the evaluation. */ @JsonProperty("operator") @ExcludeMissing - fun operator(operator: JsonField) = apply { this.operator = operator } + fun operator(operator: JsonField) = apply { + this.operator = operator + } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -1470,7 +1542,9 @@ private constructor( /** The value to be compared. */ @JsonProperty("value") @ExcludeMissing - fun value(value: JsonField) = apply { this.value = value } + fun value(value: JsonField) = apply { + this.value = value + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1482,126 +1556,114 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Threshold = - Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) + fun build(): Threshold = Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, - private val string: String? = null, - private val strings: List? = null, - private val _json: JsonValue? = null, + class Value private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { private var validated: Boolean = false fun double(): Optional = Optional.ofNullable(double) - fun boolean(): Optional = Optional.ofNullable(boolean) - fun string(): Optional = Optional.ofNullable(string) - fun strings(): Optional> = Optional.ofNullable(strings) fun isDouble(): Boolean = double != null - fun isBoolean(): Boolean = boolean != null - fun isString(): Boolean = string != null - fun isStrings(): Boolean = strings != null fun asDouble(): Double = double.getOrThrow("double") - fun asBoolean(): Boolean = boolean.getOrThrow("boolean") - fun asString(): String = string.getOrThrow("string") - fun asStrings(): List = strings.getOrThrow("strings") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { - return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) - string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - else -> visitor.unknown(_json) - } + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } } fun validate(): Value = apply { if (!validated) { - if ( - double == null && - boolean == null && - string == null && - strings == null - ) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true + if (double == null && boolean == null && string == null && strings == null) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true } } override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings } override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) + return Objects.hash( + double, + boolean, + string, + strings, + ) } override fun toString(): String { - return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" - string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } } companion object { - @JvmStatic fun ofDouble(double: Double) = Value(double = double) + @JvmStatic + fun ofDouble(double: Double) = Value(double = double) - @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic + fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - @JvmStatic fun ofString(string: String) = Value(string = string) + @JvmStatic + fun ofString(string: String) = Value(string = string) - @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + @JvmStatic + fun ofStrings(strings: List) = Value(strings = strings) } interface Visitor { @@ -1615,46 +1677,42 @@ private constructor( fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") + throw OpenlayerInvalidDataException("Unknown Value: $json") } } class Deserializer : BaseDeserializer(Value::class) { override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) } } class Serializer : BaseSerializer(Value::class) { - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider - ) { - when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) - 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 serialize(value: Value, generator: JsonGenerator, provider: SerializerProvider) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + 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") + } } } } 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 62d6be9..dbb986c 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,36 +4,46 @@ 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.JsonIgnoreProperties 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.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.getOrThrow +import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class InferencePipelineDataStreamParams -constructor( - private val inferencePipelineId: String, - private val config: Config, - private val rows: List, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class InferencePipelineDataStreamParams constructor( + private val inferencePipelineId: String, + private val config: Config, + private val rows: List, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun inferencePipelineId(): String = inferencePipelineId @@ -44,40 +54,42 @@ constructor( @JvmSynthetic internal fun getBody(): InferencePipelineDataStreamBody { - return InferencePipelineDataStreamBody( - config, - rows, - additionalBodyProperties, - ) + return InferencePipelineDataStreamBody( + config, + rows, + additionalBodyProperties, + ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic + internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } @JsonDeserialize(builder = InferencePipelineDataStreamBody.Builder::class) @NoAutoDetect - class InferencePipelineDataStreamBody - internal constructor( - private val config: Config?, - private val rows: List?, - private val additionalProperties: Map, - ) { + class InferencePipelineDataStreamBody internal constructor(private val config: Config?, private val rows: List?, private val additionalProperties: Map, ) { private var hashCode: Int = 0 - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - @JsonProperty("config") fun config(): Config? = config + /** + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. + */ + @JsonProperty("config") + fun config(): Config? = config /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") fun rows(): List? = rows + @JsonProperty("rows") + fun rows(): List? = rows @JsonAnyGetter @ExcludeMissing @@ -86,34 +98,33 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamBody && - this.config == other.config && - this.rows == other.rows && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamBody && + this.config == other.config && + this.rows == other.rows && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - config, - rows, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + config, + rows, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" + override fun toString() = "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -123,20 +134,26 @@ constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = - apply { - this.config = inferencePipelineDataStreamBody.config - this.rows = inferencePipelineDataStreamBody.rows - additionalProperties(inferencePipelineDataStreamBody.additionalProperties) - } + internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = apply { + this.config = inferencePipelineDataStreamBody.config + this.rows = inferencePipelineDataStreamBody.rows + additionalProperties(inferencePipelineDataStreamBody.additionalProperties) + } /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. */ - @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + @JsonProperty("config") + fun config(config: Config) = apply { + this.config = config + } /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } + @JsonProperty("rows") + fun rows(rows: List) = apply { + this.rows = rows + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -152,12 +169,15 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineDataStreamBody = - InferencePipelineDataStreamBody( - checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineDataStreamBody = InferencePipelineDataStreamBody( + checkNotNull(config) { + "`config` is required but was not set" + }, + checkNotNull(rows) { + "`rows` is required but was not set" + }.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) } } @@ -168,38 +188,38 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamParams && - this.inferencePipelineId == other.inferencePipelineId && - this.config == other.config && - this.rows == other.rows && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamParams && + this.inferencePipelineId == other.inferencePipelineId && + this.config == other.config && + this.rows == other.rows && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - config, - rows, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + config, + rows, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -213,37 +233,55 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = - apply { - this.inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId - this.config = inferencePipelineDataStreamParams.config - this.rows(inferencePipelineDataStreamParams.rows) - additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) - additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) - additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) - } + internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = apply { + this.inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId + this.config = inferencePipelineDataStreamParams.config + this.rows(inferencePipelineDataStreamParams.rows) + additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) + additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) + additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(config: Config) = apply { this.config = config } + /** + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. + */ + fun config(config: Config) = apply { + this.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) } + /** + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. + */ + fun config(llmData: Config.LlmData) = apply { + this.config = Config.ofLlmData(llmData) + } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. + */ fun config(tabularClassificationData: Config.TabularClassificationData) = apply { this.config = Config.ofTabularClassificationData(tabularClassificationData) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. + */ fun config(tabularRegressionData: Config.TabularRegressionData) = apply { this.config = Config.ofTabularRegressionData(tabularRegressionData) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Configuration for the data stream. Depends on your **Openlayer project task + * type**. + */ fun config(textClassificationData: Config.TextClassificationData) = apply { this.config = Config.ofTextClassificationData(textClassificationData) } @@ -255,7 +293,9 @@ constructor( } /** A list of inference data points with inputs and outputs */ - fun addRow(row: Row) = apply { this.rows.add(row) } + fun addRow(row: Row) = apply { + this.rows.add(row) + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -295,7 +335,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -306,232 +348,193 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): InferencePipelineDataStreamParams = - InferencePipelineDataStreamParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineDataStreamParams = InferencePipelineDataStreamParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + checkNotNull(config) { + "`config` is required but was not set" + }, + checkNotNull(rows) { + "`rows` is required but was not set" + }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(using = Config.Deserializer::class) @JsonSerialize(using = Config.Serializer::class) - class Config - private constructor( - private val llmData: LlmData? = null, - private val tabularClassificationData: TabularClassificationData? = null, - private val tabularRegressionData: TabularRegressionData? = null, - private val textClassificationData: TextClassificationData? = null, - private val _json: JsonValue? = null, + class Config private constructor( + private val llmData: LlmData? = null, + private val tabularClassificationData: TabularClassificationData? = null, + private val tabularRegressionData: TabularRegressionData? = null, + private val textClassificationData: TextClassificationData? = null, + private val _json: JsonValue? = null, + ) { private var validated: Boolean = false fun llmData(): Optional = Optional.ofNullable(llmData) - - fun tabularClassificationData(): Optional = - Optional.ofNullable(tabularClassificationData) - - fun tabularRegressionData(): Optional = - Optional.ofNullable(tabularRegressionData) - - fun textClassificationData(): Optional = - Optional.ofNullable(textClassificationData) + fun tabularClassificationData(): Optional = Optional.ofNullable(tabularClassificationData) + fun tabularRegressionData(): Optional = Optional.ofNullable(tabularRegressionData) + fun textClassificationData(): Optional = Optional.ofNullable(textClassificationData) fun isLlmData(): Boolean = llmData != null - fun isTabularClassificationData(): Boolean = tabularClassificationData != null - fun isTabularRegressionData(): Boolean = tabularRegressionData != null - fun isTextClassificationData(): Boolean = textClassificationData != null fun asLlmData(): LlmData = llmData.getOrThrow("llmData") - - fun asTabularClassificationData(): TabularClassificationData = - tabularClassificationData.getOrThrow("tabularClassificationData") - - fun asTabularRegressionData(): TabularRegressionData = - tabularRegressionData.getOrThrow("tabularRegressionData") - - fun asTextClassificationData(): TextClassificationData = - textClassificationData.getOrThrow("textClassificationData") + fun asTabularClassificationData(): TabularClassificationData = tabularClassificationData.getOrThrow("tabularClassificationData") + fun asTabularRegressionData(): TabularRegressionData = tabularRegressionData.getOrThrow("tabularRegressionData") + fun asTextClassificationData(): TextClassificationData = textClassificationData.getOrThrow("textClassificationData") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { - return when { - llmData != null -> visitor.visitLlmData(llmData) - tabularClassificationData != null -> - visitor.visitTabularClassificationData(tabularClassificationData) - tabularRegressionData != null -> - visitor.visitTabularRegressionData(tabularRegressionData) - textClassificationData != null -> - visitor.visitTextClassificationData(textClassificationData) - else -> visitor.unknown(_json) - } + return when { + llmData != null -> visitor.visitLlmData(llmData) + tabularClassificationData != null -> visitor.visitTabularClassificationData(tabularClassificationData) + tabularRegressionData != null -> visitor.visitTabularRegressionData(tabularRegressionData) + textClassificationData != null -> visitor.visitTextClassificationData(textClassificationData) + else -> visitor.unknown(_json) + } } 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 (llmData == null && tabularClassificationData == null && tabularRegressionData == null && textClassificationData == null) { + throw OpenlayerInvalidDataException("Unknown Config: $_json") + } + llmData?.validate() + tabularClassificationData?.validate() + tabularRegressionData?.validate() + textClassificationData?.validate() + validated = true } } override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - this.llmData == other.llmData && - this.tabularClassificationData == other.tabularClassificationData && - this.tabularRegressionData == other.tabularRegressionData && - this.textClassificationData == other.textClassificationData + if (this === other) { + return true + } + + return other is Config && + this.llmData == other.llmData && + this.tabularClassificationData == other.tabularClassificationData && + this.tabularRegressionData == other.tabularRegressionData && + this.textClassificationData == other.textClassificationData } override fun hashCode(): Int { - return Objects.hash( - llmData, - tabularClassificationData, - tabularRegressionData, - textClassificationData, - ) + return Objects.hash( + llmData, + tabularClassificationData, + tabularRegressionData, + textClassificationData, + ) } override fun toString(): String { - return when { - llmData != null -> "Config{llmData=$llmData}" - tabularClassificationData != null -> - "Config{tabularClassificationData=$tabularClassificationData}" - tabularRegressionData != null -> - "Config{tabularRegressionData=$tabularRegressionData}" - textClassificationData != null -> - "Config{textClassificationData=$textClassificationData}" - _json != null -> "Config{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Config") - } + return when { + llmData != null -> "Config{llmData=$llmData}" + tabularClassificationData != null -> "Config{tabularClassificationData=$tabularClassificationData}" + tabularRegressionData != null -> "Config{tabularRegressionData=$tabularRegressionData}" + textClassificationData != null -> "Config{textClassificationData=$textClassificationData}" + _json != null -> "Config{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Config") + } } companion object { - @JvmStatic fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) + @JvmStatic + fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) @JvmStatic - fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = - Config(tabularClassificationData = tabularClassificationData) + fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = Config(tabularClassificationData = tabularClassificationData) @JvmStatic - fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = - Config(tabularRegressionData = tabularRegressionData) + fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = Config(tabularRegressionData = tabularRegressionData) @JvmStatic - fun ofTextClassificationData(textClassificationData: TextClassificationData) = - Config(textClassificationData = textClassificationData) + fun ofTextClassificationData(textClassificationData: TextClassificationData) = Config(textClassificationData = textClassificationData) } interface Visitor { fun visitLlmData(llmData: LlmData): T - fun visitTabularClassificationData( - tabularClassificationData: TabularClassificationData - ): T + fun visitTabularClassificationData(tabularClassificationData: TabularClassificationData): T fun visitTabularRegressionData(tabularRegressionData: TabularRegressionData): T fun visitTextClassificationData(textClassificationData: TextClassificationData): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Config: $json") + throw OpenlayerInvalidDataException("Unknown Config: $json") } } class Deserializer : BaseDeserializer(Config::class) { 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 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) } } class Serializer : BaseSerializer(Config::class) { - override fun serialize( - value: Config, - generator: JsonGenerator, - provider: SerializerProvider - ) { - when { - value.llmData != null -> generator.writeObject(value.llmData) - value.tabularClassificationData != null -> - generator.writeObject(value.tabularClassificationData) - value.tabularRegressionData != null -> - generator.writeObject(value.tabularRegressionData) - value.textClassificationData != null -> - generator.writeObject(value.textClassificationData) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Config") - } + override fun serialize(value: Config, generator: JsonGenerator, provider: SerializerProvider) { + when { + value.llmData != null -> generator.writeObject(value.llmData) + value.tabularClassificationData != null -> generator.writeObject(value.tabularClassificationData) + value.tabularRegressionData != null -> generator.writeObject(value.tabularRegressionData) + value.textClassificationData != null -> generator.writeObject(value.textClassificationData) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Config") + } } } @JsonDeserialize(builder = LlmData.Builder::class) @NoAutoDetect - class LlmData - 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, + class LlmData 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, + ) { private var validated: Boolean = false @@ -539,38 +542,32 @@ constructor( private var hashCode: Int = 0 /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(): Optional = - Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + fun numOfTokenColumnName(): Optional = Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) /** - * Name of the column with the context retrieved. Applies to RAG use cases. Providing - * the context enables RAG-specific metrics. + * Name of the column with the context retrieved. Applies to RAG use cases. + * Providing the context enables RAG-specific metrics. */ - fun contextColumnName(): Optional = - Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) + fun contextColumnName(): Optional = Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) /** Name of the column with the cost associated with each row. */ - fun costColumnName(): Optional = - Optional.ofNullable(costColumnName.getNullable("costColumnName")) + fun costColumnName(): Optional = Optional.ofNullable(costColumnName.getNullable("costColumnName")) /** Name of the column with the ground truths. */ - fun groundTruthColumnName(): Optional = - Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + 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. + * 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(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** Array of input variable names. Each input variable should be a dataset column. */ - fun inputVariableNames(): Optional> = - Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) + fun inputVariableNames(): Optional> = Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model outputs. */ fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") @@ -582,15 +579,13 @@ constructor( * Name of the column with the questions. Applies to RAG use cases. Providing the * question enables RAG-specific metrics. */ - fun questionColumnName(): Optional = - Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) + fun questionColumnName(): Optional = Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. + * If not provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** Name of the column with the total number of tokens. */ @JsonProperty("numOfTokenColumnName") @@ -598,15 +593,17 @@ constructor( fun _numOfTokenColumnName() = numOfTokenColumnName /** - * Name of the column with the context retrieved. Applies to RAG use cases. Providing - * the context enables RAG-specific metrics. + * 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 /** Name of the column with the cost associated with each row. */ - @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName + @JsonProperty("costColumnName") + @ExcludeMissing + fun _costColumnName() = costColumnName /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @@ -614,8 +611,9 @@ constructor( fun _groundTruthColumnName() = 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. + * 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 @@ -632,7 +630,9 @@ constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata() = metadata /** Name of the column with the model outputs. */ @JsonProperty("outputColumnName") @@ -640,7 +640,9 @@ constructor( fun _outputColumnName() = outputColumnName /** Prompt for the LLM. */ - @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt + @JsonProperty("prompt") + @ExcludeMissing + fun _prompt() = prompt /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -651,8 +653,8 @@ constructor( fun _questionColumnName() = questionColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * 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 @@ -664,72 +666,71 @@ constructor( fun validate(): LlmData = apply { if (!validated) { - numOfTokenColumnName() - contextColumnName() - costColumnName() - groundTruthColumnName() - inferenceIdColumnName() - inputVariableNames() - latencyColumnName() - outputColumnName() - prompt().map { it.forEach { it.validate() } } - questionColumnName() - timestampColumnName() - validated = true + numOfTokenColumnName() + contextColumnName() + costColumnName() + groundTruthColumnName() + inferenceIdColumnName() + inputVariableNames() + latencyColumnName() + outputColumnName() + prompt().map { it.forEach { it.validate() } } + questionColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LlmData && - this.numOfTokenColumnName == other.numOfTokenColumnName && - this.contextColumnName == other.contextColumnName && - this.costColumnName == other.costColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.inputVariableNames == other.inputVariableNames && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.outputColumnName == other.outputColumnName && - this.prompt == other.prompt && - this.questionColumnName == other.questionColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is LlmData && + this.numOfTokenColumnName == other.numOfTokenColumnName && + this.contextColumnName == other.contextColumnName && + this.costColumnName == other.costColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.inputVariableNames == other.inputVariableNames && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.outputColumnName == other.outputColumnName && + this.prompt == other.prompt && + this.questionColumnName == other.questionColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames, - latencyColumnName, - metadata, - outputColumnName, - prompt, - questionColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames, + latencyColumnName, + metadata, + outputColumnName, + prompt, + questionColumnName, + timestampColumnName, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -766,8 +767,7 @@ constructor( } /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(numOfTokenColumnName: String) = - numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) + fun numOfTokenColumnName(numOfTokenColumnName: String) = numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) /** Name of the column with the total number of tokens. */ @JsonProperty("numOfTokenColumnName") @@ -780,8 +780,7 @@ constructor( * Name of the column with the context retrieved. Applies to RAG use cases. * Providing the context enables RAG-specific metrics. */ - fun contextColumnName(contextColumnName: String) = - contextColumnName(JsonField.of(contextColumnName)) + fun contextColumnName(contextColumnName: String) = contextColumnName(JsonField.of(contextColumnName)) /** * Name of the column with the context retrieved. Applies to RAG use cases. @@ -794,8 +793,7 @@ constructor( } /** Name of the column with the cost associated with each row. */ - fun costColumnName(costColumnName: String) = - costColumnName(JsonField.of(costColumnName)) + fun costColumnName(costColumnName: String) = costColumnName(JsonField.of(costColumnName)) /** Name of the column with the cost associated with each row. */ @JsonProperty("costColumnName") @@ -805,8 +803,7 @@ constructor( } /** Name of the column with the ground truths. */ - fun groundTruthColumnName(groundTruthColumnName: String) = - groundTruthColumnName(JsonField.of(groundTruthColumnName)) + fun groundTruthColumnName(groundTruthColumnName: String) = groundTruthColumnName(JsonField.of(groundTruthColumnName)) /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @@ -820,8 +817,7 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = - inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -834,15 +830,10 @@ constructor( this.inferenceIdColumnName = inferenceIdColumnName } - /** - * Array of input variable names. Each input variable should be a dataset column. - */ - fun inputVariableNames(inputVariableNames: List) = - inputVariableNames(JsonField.of(inputVariableNames)) + /** Array of input variable names. Each input variable should be a dataset column. */ + fun inputVariableNames(inputVariableNames: List) = inputVariableNames(JsonField.of(inputVariableNames)) - /** - * 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. */ @JsonProperty("inputVariableNames") @ExcludeMissing fun inputVariableNames(inputVariableNames: JsonField>) = apply { @@ -850,8 +841,7 @@ constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -863,11 +853,12 @@ constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + fun metadata(metadata: JsonValue) = apply { + this.metadata = metadata + } /** Name of the column with the model outputs. */ - fun outputColumnName(outputColumnName: String) = - outputColumnName(JsonField.of(outputColumnName)) + fun outputColumnName(outputColumnName: String) = outputColumnName(JsonField.of(outputColumnName)) /** Name of the column with the model outputs. */ @JsonProperty("outputColumnName") @@ -882,14 +873,15 @@ constructor( /** Prompt for the LLM. */ @JsonProperty("prompt") @ExcludeMissing - fun prompt(prompt: JsonField>) = apply { this.prompt = prompt } + fun prompt(prompt: JsonField>) = apply { + this.prompt = prompt + } /** * Name of the column with the questions. Applies to RAG use cases. Providing the * question enables RAG-specific metrics. */ - fun questionColumnName(questionColumnName: String) = - questionColumnName(JsonField.of(questionColumnName)) + fun questionColumnName(questionColumnName: String) = questionColumnName(JsonField.of(questionColumnName)) /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -902,15 +894,14 @@ constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * 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: String) = - timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = 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. + * 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 @@ -928,37 +919,30 @@ constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): LlmData = - LlmData( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames.map { it.toUnmodifiable() }, - latencyColumnName, - metadata, - outputColumnName, - prompt.map { it.toUnmodifiable() }, - questionColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): LlmData = LlmData( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames.map { it.toUnmodifiable() }, + latencyColumnName, + metadata, + outputColumnName, + prompt.map { it.toUnmodifiable() }, + questionColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Prompt.Builder::class) @NoAutoDetect - class Prompt - private constructor( - private val role: JsonField, - private val content: JsonField, - private val additionalProperties: Map, - ) { + class Prompt private constructor(private val role: JsonField, private val content: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -968,14 +952,17 @@ constructor( fun role(): Optional = Optional.ofNullable(role.getNullable("role")) /** Content of the prompt. */ - fun content(): Optional = - Optional.ofNullable(content.getNullable("content")) + fun content(): Optional = Optional.ofNullable(content.getNullable("content")) /** Role of the prompt. */ - @JsonProperty("role") @ExcludeMissing fun _role() = role + @JsonProperty("role") + @ExcludeMissing + fun _role() = role /** Content of the prompt. */ - @JsonProperty("content") @ExcludeMissing fun _content() = content + @JsonProperty("content") + @ExcludeMissing + fun _content() = content @JsonAnyGetter @ExcludeMissing @@ -983,43 +970,42 @@ constructor( fun validate(): Prompt = apply { if (!validated) { - role() - content() - validated = true + role() + content() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Prompt && - this.role == other.role && - this.content == other.content && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Prompt && + this.role == other.role && + this.content == other.content && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - role, - content, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + role, + content, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" + override fun toString() = "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1041,7 +1027,9 @@ constructor( /** Role of the prompt. */ @JsonProperty("role") @ExcludeMissing - fun role(role: JsonField) = apply { this.role = role } + fun role(role: JsonField) = apply { + this.role = role + } /** Content of the prompt. */ fun content(content: String) = content(JsonField.of(content)) @@ -1049,7 +1037,9 @@ constructor( /** Content of the prompt. */ @JsonProperty("content") @ExcludeMissing - fun content(content: JsonField) = apply { this.content = content } + fun content(content: JsonField) = apply { + this.content = content + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1061,36 +1051,34 @@ constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Prompt = - Prompt( - role, - content, - additionalProperties.toUnmodifiable(), - ) + fun build(): Prompt = Prompt( + role, + content, + additionalProperties.toUnmodifiable(), + ) } } } @JsonDeserialize(builder = TabularClassificationData.Builder::class) @NoAutoDetect - class TabularClassificationData - 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, + class TabularClassificationData 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, + ) { private var validated: Boolean = false @@ -1098,87 +1086,84 @@ constructor( private var hashCode: Int = 0 /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. ["Age", + * "Geography"]. */ - fun categoricalFeatureNames(): Optional> = - Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + 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. + * 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")) + 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. + * 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(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. */ - fun labelColumnName(): Optional = - Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + fun labelColumnName(): Optional = Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** - * Name of the column with the model's predictions as **lists of class probabilities**. + * Name of the column with the model's predictions as **lists of class + * probabilities**. */ - fun predictionScoresColumnName(): Optional = - Optional.ofNullable( - predictionScoresColumnName.getNullable("predictionScoresColumnName") - ) + fun predictionScoresColumnName(): Optional = Optional.ofNullable(predictionScoresColumnName.getNullable("predictionScoresColumnName")) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. + * If not provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. ["Age", + * "Geography"]. */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing fun _categoricalFeatureNames() = categoricalFeatureNames /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * 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() = classNames /** Array with all input feature names. */ - @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = featureNames + @JsonProperty("featureNames") + @ExcludeMissing + fun _featureNames() = 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. + * 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() = inferenceIdColumnName /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. + * 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 @@ -1190,7 +1175,9 @@ constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata() = metadata /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1198,15 +1185,16 @@ constructor( fun _predictionsColumnName() = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class probabilities**. + * Name of the column with the model's predictions as **lists of class + * probabilities**. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing fun _predictionScoresColumnName() = predictionScoresColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * 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 @@ -1218,66 +1206,65 @@ constructor( fun validate(): TabularClassificationData = apply { if (!validated) { - categoricalFeatureNames() - classNames() - featureNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - timestampColumnName() - validated = true + categoricalFeatureNames() + classNames() + featureNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularClassificationData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.classNames == other.classNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is TabularClassificationData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.classNames == other.classNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - categoricalFeatureNames, - classNames, - featureNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + categoricalFeatureNames, + classNames, + featureNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1304,39 +1291,36 @@ constructor( this.latencyColumnName = tabularClassificationData.latencyColumnName this.metadata = tabularClassificationData.metadata this.predictionsColumnName = tabularClassificationData.predictionsColumnName - this.predictionScoresColumnName = - tabularClassificationData.predictionScoresColumnName + this.predictionScoresColumnName = tabularClassificationData.predictionScoresColumnName this.timestampColumnName = tabularClassificationData.timestampColumnName additionalProperties(tabularClassificationData.additionalProperties) } /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. ["Age", + * "Geography"]. */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = - categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + fun categoricalFeatureNames(categoricalFeatureNames: List) = categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * 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 - } + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = apply { + this.categoricalFeatureNames = categoricalFeatureNames + } /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * 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. + * 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 @@ -1345,8 +1329,7 @@ constructor( } /** Array with all input feature names. */ - fun featureNames(featureNames: List) = - featureNames(JsonField.of(featureNames)) + fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ @JsonProperty("featureNames") @@ -1360,8 +1343,7 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = - inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -1378,8 +1360,7 @@ constructor( * Name of the column with the labels. The data in this column must be * **zero-indexed integers**, matching the list provided in `classNames`. */ - fun labelColumnName(labelColumnName: String) = - labelColumnName(JsonField.of(labelColumnName)) + fun labelColumnName(labelColumnName: String) = labelColumnName(JsonField.of(labelColumnName)) /** * Name of the column with the labels. The data in this column must be @@ -1392,8 +1373,7 @@ constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -1405,11 +1385,12 @@ constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + fun metadata(metadata: JsonValue) = apply { + this.metadata = metadata + } /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(predictionsColumnName: String) = - predictionsColumnName(JsonField.of(predictionsColumnName)) + fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1422,8 +1403,7 @@ constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = - predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + fun predictionScoresColumnName(predictionScoresColumnName: String) = predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** * Name of the column with the model's predictions as **lists of class @@ -1431,21 +1411,19 @@ constructor( */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = - apply { - this.predictionScoresColumnName = predictionScoresColumnName - } + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { + this.predictionScoresColumnName = predictionScoresColumnName + } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * 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: String) = - timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = 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. + * 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 @@ -1463,41 +1441,39 @@ constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): TabularClassificationData = - TabularClassificationData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - classNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): TabularClassificationData = TabularClassificationData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + classNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = TabularRegressionData.Builder::class) @NoAutoDetect - class TabularRegressionData - 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, + class TabularRegressionData 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, + ) { private var validated: Boolean = false @@ -1505,56 +1481,53 @@ constructor( private var hashCode: Int = 0 /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. ["Gender", + * "Geography"]. */ - fun categoricalFeatureNames(): Optional> = - Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) /** Array with all input feature names. */ - fun featureNames(): Optional> = - Optional.ofNullable(featureNames.getNullable("featureNames")) + 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. + * 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(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model's predictions. */ - fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** Name of the column with the targets (ground truth values). */ - fun targetColumnName(): Optional = - Optional.ofNullable(targetColumnName.getNullable("targetColumnName")) + 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. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. + * If not provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. ["Gender", + * "Geography"]. */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing fun _categoricalFeatureNames() = categoricalFeatureNames /** Array with all input feature names. */ - @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = featureNames + @JsonProperty("featureNames") + @ExcludeMissing + fun _featureNames() = 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. + * 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 @@ -1566,7 +1539,9 @@ constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata() = metadata /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @@ -1579,8 +1554,8 @@ constructor( fun _targetColumnName() = targetColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * 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 @@ -1592,60 +1567,59 @@ constructor( fun validate(): TabularRegressionData = apply { if (!validated) { - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - latencyColumnName() - predictionsColumnName() - targetColumnName() - timestampColumnName() - validated = true + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + latencyColumnName() + predictionsColumnName() + targetColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularRegressionData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.targetColumnName == other.targetColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is TabularRegressionData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.targetColumnName == other.targetColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - categoricalFeatureNames, - featureNames, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + categoricalFeatureNames, + featureNames, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + override fun toString() = "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1674,26 +1648,23 @@ constructor( } /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. ["Gender", + * "Geography"]. */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = - categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + fun categoricalFeatureNames(categoricalFeatureNames: List) = categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * 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 - } + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = apply { + this.categoricalFeatureNames = categoricalFeatureNames + } /** Array with all input feature names. */ - fun featureNames(featureNames: List) = - featureNames(JsonField.of(featureNames)) + fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ @JsonProperty("featureNames") @@ -1707,8 +1678,7 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = - inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -1722,8 +1692,7 @@ constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -1735,11 +1704,12 @@ constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + fun metadata(metadata: JsonValue) = apply { + this.metadata = metadata + } /** Name of the column with the model's predictions. */ - fun predictionsColumnName(predictionsColumnName: String) = - predictionsColumnName(JsonField.of(predictionsColumnName)) + fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @@ -1749,8 +1719,7 @@ constructor( } /** Name of the column with the targets (ground truth values). */ - fun targetColumnName(targetColumnName: String) = - targetColumnName(JsonField.of(targetColumnName)) + fun targetColumnName(targetColumnName: String) = targetColumnName(JsonField.of(targetColumnName)) /** Name of the column with the targets (ground truth values). */ @JsonProperty("targetColumnName") @@ -1760,15 +1729,14 @@ constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * 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: String) = - timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = 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. + * 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 @@ -1786,40 +1754,38 @@ constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): TabularRegressionData = - TabularRegressionData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): TabularRegressionData = TabularRegressionData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = TextClassificationData.Builder::class) @NoAutoDetect - class TextClassificationData - 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, + class TextClassificationData 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, + ) { private var validated: Boolean = false @@ -1827,69 +1793,65 @@ constructor( private var hashCode: Int = 0 /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * 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") /** - * 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. + * 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(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. */ - fun labelColumnName(): Optional = - Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + fun labelColumnName(): Optional = Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** - * Name of the column with the model's predictions as **lists of class probabilities**. + * Name of the column with the model's predictions as **lists of class + * probabilities**. */ - fun predictionScoresColumnName(): Optional = - Optional.ofNullable( - predictionScoresColumnName.getNullable("predictionScoresColumnName") - ) + fun predictionScoresColumnName(): Optional = Optional.ofNullable(predictionScoresColumnName.getNullable("predictionScoresColumnName")) /** Name of the column with the text data. */ - fun textColumnName(): Optional = - Optional.ofNullable(textColumnName.getNullable("textColumnName")) + 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. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. + * If not provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + 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. + * 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() = 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. + * 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() = inferenceIdColumnName /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. + * 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 @@ -1901,7 +1863,9 @@ constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata() = metadata /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1909,18 +1873,21 @@ constructor( fun _predictionsColumnName() = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class probabilities**. + * Name of the column with the model's predictions as **lists of class + * probabilities**. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing fun _predictionScoresColumnName() = predictionScoresColumnName /** Name of the column with the text data. */ - @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName() = textColumnName + @JsonProperty("textColumnName") + @ExcludeMissing + fun _textColumnName() = textColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * 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 @@ -1932,63 +1899,62 @@ constructor( fun validate(): TextClassificationData = apply { if (!validated) { - classNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - textColumnName() - timestampColumnName() - validated = true + classNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + textColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TextClassificationData && - this.classNames == other.classNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.textColumnName == other.textColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is TextClassificationData && + this.classNames == other.classNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.textColumnName == other.textColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - classNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + classNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + override fun toString() = "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -2012,22 +1978,21 @@ constructor( this.latencyColumnName = textClassificationData.latencyColumnName this.metadata = textClassificationData.metadata this.predictionsColumnName = textClassificationData.predictionsColumnName - this.predictionScoresColumnName = - textClassificationData.predictionScoresColumnName + this.predictionScoresColumnName = textClassificationData.predictionScoresColumnName this.textColumnName = textClassificationData.textColumnName this.timestampColumnName = textClassificationData.timestampColumnName additionalProperties(textClassificationData.additionalProperties) } /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * 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. + * 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 @@ -2040,8 +2005,7 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = - inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -2058,8 +2022,7 @@ constructor( * Name of the column with the labels. The data in this column must be * **zero-indexed integers**, matching the list provided in `classNames`. */ - fun labelColumnName(labelColumnName: String) = - labelColumnName(JsonField.of(labelColumnName)) + fun labelColumnName(labelColumnName: String) = labelColumnName(JsonField.of(labelColumnName)) /** * Name of the column with the labels. The data in this column must be @@ -2072,8 +2035,7 @@ constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = - latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -2085,11 +2047,12 @@ constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + fun metadata(metadata: JsonValue) = apply { + this.metadata = metadata + } /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(predictionsColumnName: String) = - predictionsColumnName(JsonField.of(predictionsColumnName)) + fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -2102,8 +2065,7 @@ constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = - predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + fun predictionScoresColumnName(predictionScoresColumnName: String) = predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** * Name of the column with the model's predictions as **lists of class @@ -2111,14 +2073,12 @@ constructor( */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = - apply { - this.predictionScoresColumnName = predictionScoresColumnName - } + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { + this.predictionScoresColumnName = predictionScoresColumnName + } /** Name of the column with the text data. */ - fun textColumnName(textColumnName: String) = - textColumnName(JsonField.of(textColumnName)) + fun textColumnName(textColumnName: String) = textColumnName(JsonField.of(textColumnName)) /** Name of the column with the text data. */ @JsonProperty("textColumnName") @@ -2128,15 +2088,14 @@ constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * 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: String) = - timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = 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. + * 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 @@ -2154,34 +2113,29 @@ constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): TextClassificationData = - TextClassificationData( - classNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): TextClassificationData = TextClassificationData( + classNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } } } @JsonDeserialize(builder = Row.Builder::class) @NoAutoDetect - class Row - private constructor( - private val additionalProperties: Map, - ) { + class Row private constructor(private val additionalProperties: Map, ) { private var hashCode: Int = 0 @@ -2192,25 +2146,27 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Row && this.additionalProperties == other.additionalProperties + return other is Row && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode } override fun toString() = "Row{additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -2218,7 +2174,9 @@ 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) + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() 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 087ceda..5b3ebd0 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 @@ -5,25 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.util.Objects @JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) @NoAutoDetect -class InferencePipelineDataStreamResponse -private constructor( - private val success: JsonField, - private val additionalProperties: Map, -) { +class InferencePipelineDataStreamResponse private constructor(private val success: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -31,7 +43,9 @@ private constructor( fun success(): Success = success.getRequired("success") - @JsonProperty("success") @ExcludeMissing fun _success() = success + @JsonProperty("success") + @ExcludeMissing + fun _success() = success @JsonAnyGetter @ExcludeMissing @@ -39,36 +53,36 @@ private constructor( fun validate(): InferencePipelineDataStreamResponse = apply { if (!validated) { - success() - validated = true + success() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is InferencePipelineDataStreamResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties + return other is InferencePipelineDataStreamResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode } - override fun toString() = - "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" + override fun toString() = "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -77,9 +91,7 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse - ) = apply { + internal fun from(inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse) = apply { this.success = inferencePipelineDataStreamResponse.success additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) } @@ -88,7 +100,9 @@ private constructor( @JsonProperty("success") @ExcludeMissing - fun success(success: JsonField) = apply { this.success = success } + fun success(success: JsonField) = apply { + this.success = success + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -104,24 +118,21 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineDataStreamResponse = InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) } - class Success - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Success @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Success && this.value == other.value + return other is Success && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -144,17 +155,15 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - TRUE -> Value.TRUE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - TRUE -> Known.TRUE - else -> throw OpenlayerInvalidDataException("Unknown Success: $value") - } + fun value(): Value = when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } fun asString(): String = _value().asStringOrThrow() } 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 a8072f9..cb4d161 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,25 +4,47 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class InferencePipelineRowUpdateParams -constructor( - private val inferencePipelineId: String, - private val inferenceId: String, - private val row: JsonValue, - private val config: Config?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class InferencePipelineRowUpdateParams constructor( + private val inferencePipelineId: String, + private val inferenceId: String, + private val row: JsonValue, + private val config: Config?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun inferencePipelineId(): String = inferencePipelineId @@ -35,44 +57,44 @@ constructor( @JvmSynthetic internal fun getBody(): InferencePipelineRowUpdateBody { - return InferencePipelineRowUpdateBody( - row, - config, - additionalBodyProperties, - ) + return InferencePipelineRowUpdateBody( + row, + config, + additionalBodyProperties, + ) } @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.inferenceId.let { params.put("inferenceId", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.inferenceId.let { + params.put("inferenceId", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } @JsonDeserialize(builder = InferencePipelineRowUpdateBody.Builder::class) @NoAutoDetect - class InferencePipelineRowUpdateBody - internal constructor( - private val row: JsonValue?, - private val config: Config?, - private val additionalProperties: Map, - ) { + class InferencePipelineRowUpdateBody internal constructor(private val row: JsonValue?, private val config: Config?, private val additionalProperties: Map, ) { private var hashCode: Int = 0 - @JsonProperty("row") fun row(): JsonValue? = row + @JsonProperty("row") + fun row(): JsonValue? = row - @JsonProperty("config") fun config(): Config? = config + @JsonProperty("config") + fun config(): Config? = config @JsonAnyGetter @ExcludeMissing @@ -81,34 +103,33 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRowUpdateBody && - this.row == other.row && - this.config == other.config && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineRowUpdateBody && + this.row == other.row && + this.config == other.config && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - row, - config, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + row, + config, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" + override fun toString() = "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -118,16 +139,21 @@ constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = - apply { - this.row = inferencePipelineRowUpdateBody.row - this.config = inferencePipelineRowUpdateBody.config - additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) - } + internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = apply { + this.row = inferencePipelineRowUpdateBody.row + this.config = inferencePipelineRowUpdateBody.config + additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) + } - @JsonProperty("row") fun row(row: JsonValue) = apply { this.row = row } + @JsonProperty("row") + fun row(row: JsonValue) = apply { + this.row = row + } - @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + @JsonProperty("config") + fun config(config: Config) = apply { + this.config = config + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -143,12 +169,13 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowUpdateBody = - InferencePipelineRowUpdateBody( - checkNotNull(row) { "`row` is required but was not set" }, - config, - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineRowUpdateBody = InferencePipelineRowUpdateBody( + checkNotNull(row) { + "`row` is required but was not set" + }, + config, + additionalProperties.toUnmodifiable(), + ) } } @@ -159,40 +186,40 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRowUpdateParams && - this.inferencePipelineId == other.inferencePipelineId && - this.row == other.row && - this.config == other.config && - this.inferenceId == other.inferenceId && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineRowUpdateParams && + this.inferencePipelineId == other.inferencePipelineId && + this.row == other.row && + this.config == other.config && + this.inferenceId == other.inferenceId && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - row, - config, - inferenceId, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + row, + config, + inferenceId, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -207,27 +234,32 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = - apply { - this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId - this.inferenceId = inferencePipelineRowUpdateParams.inferenceId - this.row = inferencePipelineRowUpdateParams.row - this.config = inferencePipelineRowUpdateParams.config - additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) - additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) - additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) - } + internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = apply { + this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId + this.inferenceId = inferencePipelineRowUpdateParams.inferenceId + this.row = inferencePipelineRowUpdateParams.row + this.config = inferencePipelineRowUpdateParams.config + additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) + additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) + additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId } /** Specify the inference id as a query param. */ - fun inferenceId(inferenceId: String) = apply { this.inferenceId = inferenceId } + fun inferenceId(inferenceId: String) = apply { + this.inferenceId = inferenceId + } - fun row(row: JsonValue) = apply { this.row = row } + fun row(row: JsonValue) = apply { + this.row = row + } - fun config(config: Config) = apply { this.config = config } + fun config(config: Config) = apply { + this.config = config + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -267,7 +299,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -278,52 +312,56 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - 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, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + 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, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Config.Builder::class) @NoAutoDetect - class Config - 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, + class Config 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, + ) { private var hashCode: Int = 0 /** - * 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. + * 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 /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") fun latencyColumnName(): String? = latencyColumnName + @JsonProperty("latencyColumnName") + fun latencyColumnName(): String? = latencyColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * 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 @@ -343,40 +381,39 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.timestampColumnName == other.timestampColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.humanFeedbackColumnName == other.humanFeedbackColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Config && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.timestampColumnName == other.timestampColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.humanFeedbackColumnName == other.humanFeedbackColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - inferenceIdColumnName, - latencyColumnName, - timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" + override fun toString() = "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -399,8 +436,9 @@ constructor( } /** - * 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. + * 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 { @@ -414,8 +452,8 @@ constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * 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 { @@ -448,15 +486,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Config = - Config( - inferenceIdColumnName, - latencyColumnName, - timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): Config = Config( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties.toUnmodifiable(), + ) } } } 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 35e877e..04db454 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 @@ -5,25 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.util.Objects @JsonDeserialize(builder = InferencePipelineRowUpdateResponse.Builder::class) @NoAutoDetect -class InferencePipelineRowUpdateResponse -private constructor( - private val success: JsonField, - private val additionalProperties: Map, -) { +class InferencePipelineRowUpdateResponse private constructor(private val success: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -31,7 +43,9 @@ private constructor( fun success(): Success = success.getRequired("success") - @JsonProperty("success") @ExcludeMissing fun _success() = success + @JsonProperty("success") + @ExcludeMissing + fun _success() = success @JsonAnyGetter @ExcludeMissing @@ -39,36 +53,36 @@ private constructor( fun validate(): InferencePipelineRowUpdateResponse = apply { if (!validated) { - success() - validated = true + success() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is InferencePipelineRowUpdateResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties + return other is InferencePipelineRowUpdateResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode } - override fun toString() = - "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" + override fun toString() = "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -77,17 +91,18 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = - apply { - this.success = inferencePipelineRowUpdateResponse.success - additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) - } + internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = apply { + this.success = inferencePipelineRowUpdateResponse.success + additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) + } fun success(success: Success) = success(JsonField.of(success)) @JsonProperty("success") @ExcludeMissing - fun success(success: JsonField) = apply { this.success = success } + fun success(success: JsonField) = apply { + this.success = success + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -103,24 +118,21 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowUpdateResponse = - InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineRowUpdateResponse = InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) } - class Success - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Success @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Success && this.value == other.value + return other is Success && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -143,17 +155,15 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - TRUE -> Value.TRUE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - TRUE -> Known.TRUE - else -> throw OpenlayerInvalidDataException("Unknown Success: $value") - } + fun value(): Value = when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } fun asString(): String = _value().asStringOrThrow() } 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 e82d5a1..1f3e874 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 @@ -2,27 +2,50 @@ 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.openlayer.api.core.Enum +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow +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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class InferencePipelineTestResultListParams -constructor( - private val inferencePipelineId: String, - private val page: Long?, - private val perPage: Long?, - private val status: Status?, - private val type: Type?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class InferencePipelineTestResultListParams constructor( + private val inferencePipelineId: String, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun inferencePipelineId(): String = inferencePipelineId @@ -37,22 +60,31 @@ constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - this.status?.let { params.put("status", listOf(it.toString())) } - this.type?.let { params.put("type", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.page?.let { + params.put("page", listOf(it.toString())) + } + this.perPage?.let { + params.put("perPage", listOf(it.toString())) + } + this.status?.let { + params.put("status", listOf(it.toString())) + } + this.type?.let { + params.put("type", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -62,42 +94,42 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListParams && - this.inferencePipelineId == other.inferencePipelineId && - this.page == other.page && - this.perPage == other.perPage && - this.status == other.status && - this.type == other.type && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListParams && + this.inferencePipelineId == other.inferencePipelineId && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -113,9 +145,7 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - inferencePipelineTestResultListParams: InferencePipelineTestResultListParams - ) = apply { + internal fun from(inferencePipelineTestResultListParams: InferencePipelineTestResultListParams) = apply { this.inferencePipelineId = inferencePipelineTestResultListParams.inferencePipelineId this.page = inferencePipelineTestResultListParams.page this.perPage = inferencePipelineTestResultListParams.perPage @@ -131,22 +161,30 @@ 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 + } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long) = apply { + this.perPage = perPage + } /** - * Filter list of test results by status. Available statuses are `running`, `passing`, - * `failing`, `skipped`, and `error`. + * 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: Status) = apply { + this.status = status + } /** * 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: Type) = apply { + this.type = type + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -186,7 +224,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -197,40 +237,36 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): InferencePipelineTestResultListParams = - InferencePipelineTestResultListParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - page, - perPage, - status, - type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineTestResultListParams = InferencePipelineTestResultListParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -269,43 +305,39 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun value(): Value = when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Type && this.value == other.value + return other is Type && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -344,25 +376,23 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - INTEGRITY -> Value.INTEGRITY - CONSISTENCY -> Value.CONSISTENCY - PERFORMANCE -> Value.PERFORMANCE - FAIRNESS -> Value.FAIRNESS - ROBUSTNESS -> Value.ROBUSTNESS - else -> Value._UNKNOWN - } - - 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") - } + fun value(): Value = when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 045ce71..7135f01 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 @@ -5,37 +5,37 @@ 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.JsonIgnoreProperties 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.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.Enum +import com.openlayer.api.core.getOrThrow 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.getOrThrow +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect 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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { +class InferencePipelineTestResultListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -45,9 +45,13 @@ private constructor( fun items(): List = items.getRequired("items") - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + @JsonProperty("_meta") + @ExcludeMissing + fun __meta() = _meta - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") + @ExcludeMissing + fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -55,43 +59,42 @@ private constructor( fun validate(): InferencePipelineTestResultListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -101,9 +104,7 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse - ) = apply { + internal fun from(inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse) = apply { this._meta = inferencePipelineTestResultListResponse._meta this.items = inferencePipelineTestResultListResponse.items additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) @@ -113,13 +114,17 @@ private constructor( @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun _meta(_meta: JsonField<_Meta>) = apply { + this._meta = _meta + } 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 + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -135,23 +140,22 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineTestResultListResponse = - InferencePipelineTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, + class _Meta private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -171,16 +175,24 @@ private constructor( fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page + @JsonProperty("page") + @ExcludeMissing + fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + @JsonProperty("perPage") + @ExcludeMissing + fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + @JsonProperty("totalItems") + @ExcludeMissing + fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + @JsonProperty("totalPages") + @ExcludeMissing + fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -188,49 +200,48 @@ private constructor( fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -256,7 +267,9 @@ private constructor( /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } + fun page(page: JsonField) = apply { + this.page = page + } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -264,7 +277,9 @@ private constructor( /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + fun perPage(perPage: JsonField) = apply { + this.perPage = perPage + } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -272,7 +287,9 @@ private constructor( /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + fun totalItems(totalItems: JsonField) = apply { + this.totalItems = totalItems + } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -280,7 +297,9 @@ private constructor( /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + fun totalPages(totalPages: JsonField) = apply { + this.totalPages = totalPages + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -296,33 +315,32 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item - 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, + class Item 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, + ) { private var validated: Boolean = false @@ -338,12 +356,10 @@ private constructor( fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) /** The project version (commit) id. */ - fun projectVersionId(): Optional = - Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = - Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -352,30 +368,35 @@ private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The data start date. */ - fun dateDataStarts(): Optional = - Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) /** The data end date. */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) /** The status of the test. */ fun status(): Status = status.getRequired("status") /** The status message. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** Project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id - @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + @JsonProperty("goal") + @ExcludeMissing + fun _goal() = goal /** The test id. */ - @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + @JsonProperty("goalId") + @ExcludeMissing + fun _goalId() = goalId /** The project version (commit) id. */ - @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + @JsonProperty("projectVersionId") + @ExcludeMissing + fun _projectVersionId() = projectVersionId /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -383,22 +404,34 @@ private constructor( fun _inferencePipelineId() = inferencePipelineId /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The data start date. */ - @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun _dateDataStarts() = dateDataStarts /** The data end date. */ - @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun _dateDataEnds() = dateDataEnds /** The status of the test. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") + @ExcludeMissing + fun _status() = status /** The status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage() = statusMessage @JsonAnyGetter @ExcludeMissing @@ -406,70 +439,69 @@ private constructor( fun validate(): Item = apply { if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -509,13 +541,17 @@ private constructor( /** Project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + 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 } + fun goal(goal: JsonField) = apply { + this.goal = goal + } /** The test id. */ fun goalId(goalId: String) = goalId(JsonField.of(goalId)) @@ -523,11 +559,12 @@ private constructor( /** The test id. */ @JsonProperty("goalId") @ExcludeMissing - fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + fun goalId(goalId: JsonField) = apply { + this.goalId = goalId + } /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = - projectVersionId(JsonField.of(projectVersionId)) + fun projectVersionId(projectVersionId: String) = projectVersionId(JsonField.of(projectVersionId)) /** The project version (commit) id. */ @JsonProperty("projectVersionId") @@ -537,8 +574,7 @@ private constructor( } /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = - inferencePipelineId(JsonField.of(inferencePipelineId)) + fun inferencePipelineId(inferencePipelineId: String) = inferencePipelineId(JsonField.of(inferencePipelineId)) /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -568,8 +604,7 @@ private constructor( } /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = - dateDataStarts(JsonField.of(dateDataStarts)) + fun dateDataStarts(dateDataStarts: OffsetDateTime) = dateDataStarts(JsonField.of(dateDataStarts)) /** The data start date. */ @JsonProperty("dateDataStarts") @@ -579,8 +614,7 @@ private constructor( } /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = - dateDataEnds(JsonField.of(dateDataEnds)) + fun dateDataEnds(dateDataEnds: OffsetDateTime) = dateDataEnds(JsonField.of(dateDataEnds)) /** The data end date. */ @JsonProperty("dateDataEnds") @@ -595,7 +629,9 @@ private constructor( /** The status of the test. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + fun status(status: JsonField) = apply { + this.status = status + } /** The status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -621,37 +657,34 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = - Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -690,56 +723,54 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun known(): Known = when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = Goal.Builder::class) @NoAutoDetect - class Goal - 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, + class Goal 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, + ) { private var validated: Boolean = false @@ -761,13 +792,14 @@ 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 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")) + fun delayWindow(): Optional = Optional.ofNullable(delayWindow.getNullable("delayWindow")) /** The test type. */ fun type(): String = type.getRequired("type") @@ -776,22 +808,18 @@ private constructor( fun subtype(): String = subtype.getRequired("subtype") /** The test creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(): Optional = - Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) fun thresholds(): List = thresholds.getRequired("thresholds") /** Whether the test is archived. */ - fun archived(): Optional = - Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) /** The date the test was archived. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** Whether the test is suggested or user-created. */ fun suggested(): Boolean = suggested.getRequired("suggested") @@ -800,81 +828,111 @@ private constructor( fun commentCount(): Long = commentCount.getRequired("commentCount") /** Whether the test uses an ML model. */ - fun usesMlModel(): Optional = - Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = - Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = - Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(): Optional = - Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + 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")) + fun usesProductionData(): Optional = Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** The test id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The test number. */ - @JsonProperty("number") @ExcludeMissing fun _number() = number + @JsonProperty("number") + @ExcludeMissing + fun _number() = number /** The test name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The test description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("description") + @ExcludeMissing + fun _description() = description - /** 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. + */ @JsonProperty("evaluationWindow") @ExcludeMissing fun _evaluationWindow() = evaluationWindow /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + @JsonProperty("delayWindow") + @ExcludeMissing + fun _delayWindow() = delayWindow /** The test type. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonProperty("type") + @ExcludeMissing + fun _type() = type /** The test subtype. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + @JsonProperty("subtype") + @ExcludeMissing + fun _subtype() = subtype /** The test creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId() = creatorId /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @ExcludeMissing fun _originProjectVersionId() = originProjectVersionId - @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + @JsonProperty("thresholds") + @ExcludeMissing + fun _thresholds() = thresholds /** Whether the test is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + @JsonProperty("archived") + @ExcludeMissing + fun _archived() = archived /** The date the test was archived. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived() = dateArchived /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested + @JsonProperty("suggested") + @ExcludeMissing + fun _suggested() = suggested /** The number of comments on the test. */ - @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount() = commentCount /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel + @JsonProperty("usesMlModel") + @ExcludeMissing + fun _usesMlModel() = usesMlModel /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -902,102 +960,101 @@ private constructor( 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 + 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 } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - 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, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = 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, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1059,7 +1116,9 @@ private constructor( /** The test id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { + this.id = id + } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) @@ -1067,7 +1126,9 @@ private constructor( /** The test number. */ @JsonProperty("number") @ExcludeMissing - fun number(number: JsonField) = apply { this.number = number } + fun number(number: JsonField) = apply { + this.number = number + } /** The test name. */ fun name(name: String) = name(JsonField.of(name)) @@ -1075,11 +1136,12 @@ private constructor( /** The test name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun name(name: JsonField) = apply { + this.name = name + } /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = - dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The creation date. */ @JsonProperty("dateCreated") @@ -1089,8 +1151,7 @@ private constructor( } /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = - dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ @JsonProperty("dateUpdated") @@ -1102,16 +1163,19 @@ private constructor( /** The test description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonValue) = apply { this.description = description } + fun description(description: JsonValue) = apply { + this.description = description + } /** - * 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. */ - fun evaluationWindow(evaluationWindow: Double) = - evaluationWindow(JsonField.of(evaluationWindow)) + fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(JsonField.of(evaluationWindow)) /** - * 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. */ @JsonProperty("evaluationWindow") @ExcludeMissing @@ -1135,7 +1199,9 @@ private constructor( /** The test type. */ @JsonProperty("type") @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonField) = apply { + this.type = type + } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) @@ -1143,7 +1209,9 @@ private constructor( /** The test subtype. */ @JsonProperty("subtype") @ExcludeMissing - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun subtype(subtype: JsonField) = apply { + this.subtype = subtype + } /** The test creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -1151,11 +1219,12 @@ private constructor( /** The test creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + 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)) + fun originProjectVersionId(originProjectVersionId: String) = originProjectVersionId(JsonField.of(originProjectVersionId)) /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @@ -1178,11 +1247,12 @@ private constructor( /** Whether the test is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { this.archived = archived } + fun archived(archived: JsonField) = apply { + this.archived = archived + } /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = - dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) /** The date the test was archived. */ @JsonProperty("dateArchived") @@ -1197,7 +1267,9 @@ private constructor( /** Whether the test is suggested or user-created. */ @JsonProperty("suggested") @ExcludeMissing - fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + fun suggested(suggested: JsonField) = apply { + this.suggested = suggested + } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) @@ -1220,8 +1292,7 @@ private constructor( } /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = - usesValidationDataset(JsonField.of(usesValidationDataset)) + fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -1231,8 +1302,7 @@ private constructor( } /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = - usesTrainingDataset(JsonField.of(usesTrainingDataset)) + fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) /** Whether the test uses a training dataset. */ @JsonProperty("usesTrainingDataset") @@ -1242,8 +1312,7 @@ private constructor( } /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = - usesReferenceDataset(JsonField.of(usesReferenceDataset)) + fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @@ -1253,8 +1322,7 @@ private constructor( } /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = - usesProductionData(JsonField.of(usesProductionData)) + fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) /** Whether the test uses production data (monitoring mode only). */ @JsonProperty("usesProductionData") @@ -1273,49 +1341,47 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Goal = - Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties.toUnmodifiable(), - ) + fun build(): Goal = Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Threshold.Builder::class) @NoAutoDetect - class Threshold - 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, + class Threshold 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, + ) { private var validated: Boolean = false @@ -1323,38 +1389,42 @@ private constructor( private var hashCode: Int = 0 /** The measurement to be evaluated. */ - fun measurement(): Optional = - Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) /** The insight name to be evaluated. */ - fun insightName(): Optional = - Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) - fun insightParameters(): Optional> = - Optional.ofNullable(insightParameters.getNullable("insightParameters")) + fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) /** The operator to be used for the evaluation. */ - fun operator(): Optional = - Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) /** The value to be compared. */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) /** The measurement to be evaluated. */ - @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement() = measurement /** The insight name to be evaluated. */ - @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName() = insightName @JsonProperty("insightParameters") @ExcludeMissing fun _insightParameters() = insightParameters /** The operator to be used for the evaluation. */ - @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + @JsonProperty("operator") + @ExcludeMissing + fun _operator() = operator /** The value to be compared. */ - @JsonProperty("value") @ExcludeMissing fun _value() = value + @JsonProperty("value") + @ExcludeMissing + fun _value() = value @JsonAnyGetter @ExcludeMissing @@ -1362,52 +1432,51 @@ private constructor( fun validate(): Threshold = apply { if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + measurement() + insightName() + insightParameters() + operator() + value() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + override fun toString() = "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1449,8 +1518,7 @@ private constructor( this.insightName = insightName } - fun insightParameters(insightParameters: List) = - insightParameters(JsonField.of(insightParameters)) + fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) @JsonProperty("insightParameters") @ExcludeMissing @@ -1464,7 +1532,9 @@ private constructor( /** The operator to be used for the evaluation. */ @JsonProperty("operator") @ExcludeMissing - fun operator(operator: JsonField) = apply { this.operator = operator } + fun operator(operator: JsonField) = apply { + this.operator = operator + } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -1472,7 +1542,9 @@ private constructor( /** The value to be compared. */ @JsonProperty("value") @ExcludeMissing - fun value(value: JsonField) = apply { this.value = value } + fun value(value: JsonField) = apply { + this.value = value + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1484,126 +1556,114 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Threshold = - Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) + fun build(): Threshold = Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, - private val string: String? = null, - private val strings: List? = null, - private val _json: JsonValue? = null, + class Value private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { private var validated: Boolean = false fun double(): Optional = Optional.ofNullable(double) - fun boolean(): Optional = Optional.ofNullable(boolean) - fun string(): Optional = Optional.ofNullable(string) - fun strings(): Optional> = Optional.ofNullable(strings) fun isDouble(): Boolean = double != null - fun isBoolean(): Boolean = boolean != null - fun isString(): Boolean = string != null - fun isStrings(): Boolean = strings != null fun asDouble(): Double = double.getOrThrow("double") - fun asBoolean(): Boolean = boolean.getOrThrow("boolean") - fun asString(): String = string.getOrThrow("string") - fun asStrings(): List = strings.getOrThrow("strings") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { - return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) - string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - else -> visitor.unknown(_json) - } + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } } fun validate(): Value = apply { if (!validated) { - if ( - double == null && - boolean == null && - string == null && - strings == null - ) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true + if (double == null && boolean == null && string == null && strings == null) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true } } override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings } override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) + return Objects.hash( + double, + boolean, + string, + strings, + ) } override fun toString(): String { - return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" - string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } } companion object { - @JvmStatic fun ofDouble(double: Double) = Value(double = double) + @JvmStatic + fun ofDouble(double: Double) = Value(double = double) - @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic + fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - @JvmStatic fun ofString(string: String) = Value(string = string) + @JvmStatic + fun ofString(string: String) = Value(string = string) - @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + @JvmStatic + fun ofStrings(strings: List) = Value(strings = strings) } interface Visitor { @@ -1617,46 +1677,42 @@ private constructor( fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") + throw OpenlayerInvalidDataException("Unknown Value: $json") } } class Deserializer : BaseDeserializer(Value::class) { override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) } } class Serializer : BaseSerializer(Value::class) { - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider - ) { - when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) - 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 serialize(value: Value, generator: JsonGenerator, provider: SerializerProvider) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + 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") + } } } } 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 9266137..011a534 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 @@ -2,21 +2,48 @@ 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.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow +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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class ProjectCommitListParams -constructor( - private val projectId: String, - private val page: Long?, - private val perPage: Long?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class ProjectCommitListParams constructor( + private val projectId: String, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun projectId(): String = projectId @@ -27,20 +54,25 @@ constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.page?.let { + params.put("page", listOf(it.toString())) + } + this.perPage?.let { + params.put("perPage", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -50,38 +82,38 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListParams && - this.projectId == other.projectId && - this.page == other.page && - this.perPage == other.perPage && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectCommitListParams && + this.projectId == other.projectId && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectId, - page, - perPage, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectId, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -104,13 +136,19 @@ constructor( additionalBodyProperties(projectCommitListParams.additionalBodyProperties) } - fun projectId(projectId: String) = apply { this.projectId = projectId } + 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 + } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long) = apply { + this.perPage = perPage + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -150,7 +188,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -161,19 +201,19 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectCommitListParams = - ProjectCommitListParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, - page, - perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectCommitListParams = ProjectCommitListParams( + checkNotNull(projectId) { + "`projectId` is required but was not set" + }, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } 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 da9d1fd..482f11f 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 @@ -5,28 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect 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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { +class ProjectCommitListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -36,9 +45,13 @@ private constructor( fun items(): List = items.getRequired("items") - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + @JsonProperty("_meta") + @ExcludeMissing + fun __meta() = _meta - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") + @ExcludeMissing + fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -46,43 +59,42 @@ private constructor( fun validate(): ProjectCommitListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectCommitListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -102,13 +114,17 @@ private constructor( @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun _meta(_meta: JsonField<_Meta>) = apply { + this._meta = _meta + } 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 + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -124,23 +140,22 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCommitListResponse = - ProjectCommitListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCommitListResponse = ProjectCommitListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, + class _Meta private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -160,16 +175,24 @@ private constructor( fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page + @JsonProperty("page") + @ExcludeMissing + fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + @JsonProperty("perPage") + @ExcludeMissing + fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + @JsonProperty("totalItems") + @ExcludeMissing + fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + @JsonProperty("totalPages") + @ExcludeMissing + fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -177,49 +200,48 @@ private constructor( fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -245,7 +267,9 @@ private constructor( /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } + fun page(page: JsonField) = apply { + this.page = page + } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -253,7 +277,9 @@ private constructor( /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + fun perPage(perPage: JsonField) = apply { + this.perPage = perPage + } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -261,7 +287,9 @@ private constructor( /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + fun totalItems(totalItems: JsonField) = apply { + this.totalItems = totalItems + } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -269,7 +297,9 @@ private constructor( /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + fun totalPages(totalPages: JsonField) = apply { + this.totalPages = totalPages + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -285,39 +315,38 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item - 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, + class Item 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, + ) { private var validated: Boolean = false @@ -331,14 +360,13 @@ private constructor( fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * 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")) + fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** The project id. */ fun projectId(): String = projectId.getRequired("projectId") @@ -350,26 +378,22 @@ private constructor( fun commit(): Commit = commit.getRequired("commit") /** The deployment status associated with the commit's model. */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) /** The model id. */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The training dataset id. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) /** Whether the commit is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) /** The commit archive date. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** The number of tests that are passing for the commit. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -383,34 +407,52 @@ private constructor( fun links(): Optional = Optional.ofNullable(links.getNullable("links")) /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * 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() = status /** The commit status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage() = statusMessage /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId() = projectId /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri() = storageUri /** The details of a commit (project version). */ - @JsonProperty("commit") @ExcludeMissing fun _commit() = commit + @JsonProperty("commit") + @ExcludeMissing + fun _commit() = commit /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus() = deploymentStatus + @JsonProperty("deploymentStatus") + @ExcludeMissing + fun _deploymentStatus() = deploymentStatus /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") + @ExcludeMissing + fun _mlModelId() = mlModelId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -423,21 +465,33 @@ private constructor( fun _trainingDatasetId() = trainingDatasetId /** Whether the commit is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + @JsonProperty("archived") + @ExcludeMissing + fun _archived() = archived /** The commit archive date. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived() = dateArchived /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount() = passingGoalCount /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount() = failingGoalCount /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount() = totalGoalCount - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") + @ExcludeMissing + fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -445,88 +499,87 @@ private constructor( 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 + id() + dateCreated() + status() + statusMessage() + projectId() + storageUri() + commit().validate() + deploymentStatus() + mlModelId() + validationDatasetId() + trainingDatasetId() + archived() + dateArchived() + passingGoalCount() + failingGoalCount() + totalGoalCount() + links().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.dateCreated == other.dateCreated && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.projectId == other.projectId && - this.storageUri == other.storageUri && - this.commit == other.commit && - this.deploymentStatus == other.deploymentStatus && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.links == other.links && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.dateCreated == other.dateCreated && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.projectId == other.projectId && + this.storageUri == other.storageUri && + this.commit == other.commit && + this.deploymentStatus == other.deploymentStatus && + this.mlModelId == other.mlModelId && + this.validationDatasetId == other.validationDatasetId && + this.trainingDatasetId == other.trainingDatasetId && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.links == other.links && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -578,7 +631,9 @@ private constructor( /** 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 project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -591,18 +646,20 @@ private constructor( } /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * 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`. + * 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 } + fun status(status: JsonField) = apply { + this.status = status + } /** The commit status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -620,7 +677,9 @@ private constructor( /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + 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)) @@ -628,7 +687,9 @@ private constructor( /** The storage URI where the commit bundle is stored. */ @JsonProperty("storageUri") @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + fun storageUri(storageUri: JsonField) = apply { + this.storageUri = storageUri + } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) @@ -636,11 +697,12 @@ private constructor( /** The details of a commit (project version). */ @JsonProperty("commit") @ExcludeMissing - fun commit(commit: JsonField) = apply { this.commit = commit } + fun commit(commit: JsonField) = apply { + this.commit = commit + } /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = - deploymentStatus(JsonField.of(deploymentStatus)) + fun deploymentStatus(deploymentStatus: String) = deploymentStatus(JsonField.of(deploymentStatus)) /** The deployment status associated with the commit's model. */ @JsonProperty("deploymentStatus") @@ -655,11 +717,12 @@ private constructor( /** The model id. */ @JsonProperty("mlModelId") @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + fun mlModelId(mlModelId: JsonField) = apply { + this.mlModelId = mlModelId + } /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: String) = validationDatasetId(JsonField.of(validationDatasetId)) /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -669,8 +732,7 @@ private constructor( } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String) = trainingDatasetId(JsonField.of(trainingDatasetId)) /** The training dataset id. */ @JsonProperty("trainingDatasetId") @@ -685,11 +747,12 @@ private constructor( /** Whether the commit is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { this.archived = archived } + fun archived(archived: JsonField) = apply { + this.archived = archived + } /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime) = - dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) /** The commit archive date. */ @JsonProperty("dateArchived") @@ -699,8 +762,7 @@ private constructor( } /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests that are passing for the commit. */ @JsonProperty("passingGoalCount") @@ -710,8 +772,7 @@ private constructor( } /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests that are failing for the commit. */ @JsonProperty("failingGoalCount") @@ -734,7 +795,9 @@ private constructor( @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun links(links: JsonField) = apply { + this.links = links + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -750,47 +813,46 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = - Item( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = Item( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties.toUnmodifiable(), + ) } /** The details of a commit (project version). */ @JsonDeserialize(builder = Commit.Builder::class) @NoAutoDetect - class Commit - 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, + class Commit 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, + ) { private var validated: Boolean = false @@ -804,8 +866,7 @@ private constructor( fun authorId(): String = authorId.getRequired("authorId") /** The commit creation date. */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) /** The size of the commit bundle in bytes. */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) @@ -814,49 +875,55 @@ private constructor( fun message(): String = message.getRequired("message") /** The model id. */ - fun mlModelId(): Optional = - Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The training dataset id. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) /** The storage URI where the commit bundle is stored. */ fun storageUri(): String = storageUri.getRequired("storageUri") /** The SHA of the corresponding git commit. */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + fun gitCommitSha(): Optional = Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) /** The ref of the corresponding git commit. */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) /** The URL of the corresponding git commit. */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) /** The commit id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The author id of the commit. */ - @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId + @JsonProperty("authorId") + @ExcludeMissing + fun _authorId() = authorId /** The commit creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize + @JsonProperty("fileSize") + @ExcludeMissing + fun _fileSize() = fileSize /** The commit message. */ - @JsonProperty("message") @ExcludeMissing fun _message() = message + @JsonProperty("message") + @ExcludeMissing + fun _message() = message /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") + @ExcludeMissing + fun _mlModelId() = mlModelId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -869,16 +936,24 @@ private constructor( fun _trainingDatasetId() = trainingDatasetId /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri() = storageUri /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha + @JsonProperty("gitCommitSha") + @ExcludeMissing + fun _gitCommitSha() = gitCommitSha /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef + @JsonProperty("gitCommitRef") + @ExcludeMissing + fun _gitCommitRef() = gitCommitRef /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl + @JsonProperty("gitCommitUrl") + @ExcludeMissing + fun _gitCommitUrl() = gitCommitUrl @JsonAnyGetter @ExcludeMissing @@ -886,73 +961,72 @@ private constructor( fun validate(): Commit = apply { if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true + id() + authorId() + dateCreated() + fileSize() + message() + mlModelId() + validationDatasetId() + trainingDatasetId() + storageUri() + gitCommitSha() + gitCommitRef() + gitCommitUrl() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Commit && - this.id == other.id && - this.authorId == other.authorId && - this.dateCreated == other.dateCreated && - this.fileSize == other.fileSize && - this.message == other.message && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.storageUri == other.storageUri && - this.gitCommitSha == other.gitCommitSha && - this.gitCommitRef == other.gitCommitRef && - this.gitCommitUrl == other.gitCommitUrl && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Commit && + this.id == other.id && + this.authorId == other.authorId && + this.dateCreated == other.dateCreated && + this.fileSize == other.fileSize && + this.message == other.message && + this.mlModelId == other.mlModelId && + this.validationDatasetId == other.validationDatasetId && + this.trainingDatasetId == other.trainingDatasetId && + this.storageUri == other.storageUri && + this.gitCommitSha == other.gitCommitSha && + this.gitCommitRef == other.gitCommitRef && + this.gitCommitUrl == other.gitCommitUrl && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -994,7 +1068,9 @@ private constructor( /** The commit id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { + this.id = id + } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) @@ -1002,11 +1078,12 @@ private constructor( /** The author id of the commit. */ @JsonProperty("authorId") @ExcludeMissing - fun authorId(authorId: JsonField) = apply { this.authorId = authorId } + fun authorId(authorId: JsonField) = apply { + this.authorId = authorId + } /** The commit creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = - dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The commit creation date. */ @JsonProperty("dateCreated") @@ -1021,7 +1098,9 @@ private constructor( /** The size of the commit bundle in bytes. */ @JsonProperty("fileSize") @ExcludeMissing - fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } + fun fileSize(fileSize: JsonField) = apply { + this.fileSize = fileSize + } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) @@ -1029,7 +1108,9 @@ private constructor( /** The commit message. */ @JsonProperty("message") @ExcludeMissing - fun message(message: JsonField) = apply { this.message = message } + fun message(message: JsonField) = apply { + this.message = message + } /** The model id. */ fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) @@ -1037,11 +1118,12 @@ private constructor( /** The model id. */ @JsonProperty("mlModelId") @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + fun mlModelId(mlModelId: JsonField) = apply { + this.mlModelId = mlModelId + } /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: String) = validationDatasetId(JsonField.of(validationDatasetId)) /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -1051,8 +1133,7 @@ private constructor( } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String) = trainingDatasetId(JsonField.of(trainingDatasetId)) /** The training dataset id. */ @JsonProperty("trainingDatasetId") @@ -1111,44 +1192,40 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Commit = - Commit( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties.toUnmodifiable(), - ) + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Commit = Commit( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties.toUnmodifiable(), + ) } } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -1191,38 +1268,32 @@ private constructor( _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -1230,7 +1301,9 @@ private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") + @ExcludeMissing + fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -1238,35 +1311,36 @@ private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1284,7 +1358,9 @@ private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { this.app = app } + fun app(app: JsonField) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1296,10 +1372,9 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } 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 559574f..c4e23aa 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 @@ -5,28 +5,45 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional -class ProjectCreateParams -constructor( - private val name: String, - private val taskType: TaskType, - private val description: String?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class ProjectCreateParams constructor( + private val name: String, + private val taskType: TaskType, + private val description: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun name(): String = name @@ -37,38 +54,43 @@ constructor( @JvmSynthetic internal fun getBody(): ProjectCreateBody { - return ProjectCreateBody( - name, - taskType, - description, - additionalBodyProperties, - ) + return ProjectCreateBody( + name, + taskType, + description, + additionalBodyProperties, + ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic + internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders @JsonDeserialize(builder = ProjectCreateBody.Builder::class) @NoAutoDetect - class ProjectCreateBody - internal constructor( - private val name: String?, - private val taskType: TaskType?, - private val description: String?, - private val additionalProperties: Map, + class ProjectCreateBody internal constructor( + private val name: String?, + private val taskType: TaskType?, + private val description: String?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 /** The project name. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") + fun name(): String? = name /** The task type of the project. */ - @JsonProperty("taskType") fun taskType(): TaskType? = taskType + @JsonProperty("taskType") + fun taskType(): TaskType? = taskType /** The project description. */ - @JsonProperty("description") fun description(): String? = description + @JsonProperty("description") + fun description(): String? = description @JsonAnyGetter @ExcludeMissing @@ -77,36 +99,35 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is ProjectCreateBody && - this.name == other.name && - this.taskType == other.taskType && - this.description == other.description && - this.additionalProperties == other.additionalProperties + return other is ProjectCreateBody && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - name, - taskType, - description, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + name, + taskType, + description, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" + override fun toString() = "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -125,15 +146,22 @@ constructor( } /** The project name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + @JsonProperty("name") + fun name(name: String) = apply { + this.name = name + } /** The task type of the project. */ @JsonProperty("taskType") - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + fun taskType(taskType: TaskType) = apply { + this.taskType = taskType + } /** The project description. */ @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String) = apply { + this.description = description + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -149,13 +177,16 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCreateBody = - ProjectCreateBody( - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(taskType) { "`taskType` is required but was not set" }, - description, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateBody = ProjectCreateBody( + checkNotNull(name) { + "`name` is required but was not set" + }, + checkNotNull(taskType) { + "`taskType` is required but was not set" + }, + description, + additionalProperties.toUnmodifiable(), + ) } } @@ -166,38 +197,38 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCreateParams && - this.name == other.name && - this.taskType == other.taskType && - this.description == other.description && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectCreateParams && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - name, - taskType, - description, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + name, + taskType, + description, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -221,13 +252,19 @@ constructor( } /** The project name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { + this.name = name + } /** The task type of the project. */ - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + fun taskType(taskType: TaskType) = apply { + this.taskType = taskType + } /** The project description. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String) = apply { + this.description = description + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -267,7 +304,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -278,34 +317,33 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): ProjectCreateParams = - ProjectCreateParams( - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(taskType) { "`taskType` is required but was not set" }, - description, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateParams = ProjectCreateParams( + checkNotNull(name) { + "`name` is required but was not set" + }, + checkNotNull(taskType) { + "`taskType` is required but was not set" + }, + description, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: String?, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: String?, private val additionalProperties: Map, ) { private var hashCode: Int = 0 - @JsonProperty("app") fun app(): String? = app + @JsonProperty("app") + fun app(): String? = app @JsonAnyGetter @ExcludeMissing @@ -314,27 +352,28 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -348,7 +387,10 @@ constructor( additionalProperties(links.additionalProperties) } - @JsonProperty("app") fun app(app: String) = apply { this.app = app } + @JsonProperty("app") + fun app(app: String) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -364,28 +406,24 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() - ) + fun build(): Links = Links(checkNotNull(app) { + "`app` is required but was not set" + }, additionalProperties.toUnmodifiable()) } } - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && this.value == other.value + return other is Source && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -416,39 +454,35 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && this.value == other.value + return other is TaskType && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -483,71 +517,81 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo - 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, + class GitRepo 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, + ) { private var hashCode: Int = 0 - @JsonProperty("id") fun id(): String? = id + @JsonProperty("id") + fun id(): String? = id - @JsonProperty("gitId") fun gitId(): Long? = gitId + @JsonProperty("gitId") + fun gitId(): Long? = gitId - @JsonProperty("dateConnected") fun dateConnected(): OffsetDateTime? = dateConnected + @JsonProperty("dateConnected") + fun dateConnected(): OffsetDateTime? = dateConnected - @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + @JsonProperty("dateUpdated") + fun dateUpdated(): OffsetDateTime? = dateUpdated - @JsonProperty("branch") fun branch(): String? = branch + @JsonProperty("branch") + fun branch(): String? = branch - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") + fun name(): String? = name - @JsonProperty("private") fun private_(): Boolean? = private_ + @JsonProperty("private") + fun private_(): Boolean? = private_ - @JsonProperty("slug") fun slug(): String? = slug + @JsonProperty("slug") + fun slug(): String? = slug - @JsonProperty("url") fun url(): String? = url + @JsonProperty("url") + fun url(): String? = url - @JsonProperty("rootDir") fun rootDir(): String? = rootDir + @JsonProperty("rootDir") + fun rootDir(): String? = rootDir - @JsonProperty("projectId") fun projectId(): String? = projectId + @JsonProperty("projectId") + fun projectId(): String? = projectId - @JsonProperty("gitAccountId") fun gitAccountId(): String? = gitAccountId + @JsonProperty("gitAccountId") + fun gitAccountId(): String? = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -556,54 +600,53 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -639,9 +682,15 @@ constructor( additionalProperties(gitRepo.additionalProperties) } - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + @JsonProperty("id") + fun id(id: String) = apply { + this.id = id + } - @JsonProperty("gitId") fun gitId(gitId: Long) = apply { this.gitId = gitId } + @JsonProperty("gitId") + fun gitId(gitId: Long) = apply { + this.gitId = gitId + } @JsonProperty("dateConnected") fun dateConnected(dateConnected: OffsetDateTime) = apply { @@ -649,26 +698,49 @@ constructor( } @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { + this.dateUpdated = dateUpdated + } - @JsonProperty("branch") fun branch(branch: String) = apply { this.branch = branch } + @JsonProperty("branch") + fun branch(branch: String) = apply { + this.branch = branch + } - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + @JsonProperty("name") + fun name(name: String) = apply { + this.name = name + } @JsonProperty("private") - fun private_(private_: Boolean) = apply { this.private_ = private_ } + fun private_(private_: Boolean) = apply { + this.private_ = private_ + } - @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } + @JsonProperty("slug") + fun slug(slug: String) = apply { + this.slug = slug + } - @JsonProperty("url") fun url(url: String) = apply { this.url = url } + @JsonProperty("url") + fun url(url: String) = apply { + this.url = url + } - @JsonProperty("rootDir") fun rootDir(rootDir: String) = apply { this.rootDir = rootDir } + @JsonProperty("rootDir") + fun rootDir(rootDir: String) = apply { + this.rootDir = rootDir + } @JsonProperty("projectId") - fun projectId(projectId: String) = apply { this.projectId = projectId } + fun projectId(projectId: String) = apply { + this.projectId = projectId + } @JsonProperty("gitAccountId") - fun gitAccountId(gitAccountId: String) = apply { this.gitAccountId = gitAccountId } + fun gitAccountId(gitAccountId: String) = apply { + this.gitAccountId = gitAccountId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -684,22 +756,41 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - 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" }, - 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.toUnmodifiable(), - ) + 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" + }, + 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.toUnmodifiable(), + ) } } } 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 eb6afee..edc4a49 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 @@ -5,41 +5,55 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect 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 -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, +class ProjectCreateResponse 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, + ) { private var validated: Boolean = false @@ -50,8 +64,7 @@ private constructor( fun id(): String = id.getRequired("id") /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) @@ -66,8 +79,7 @@ private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -79,8 +91,7 @@ private constructor( fun versionCount(): Long = versionCount.getRequired("versionCount") /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") + fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") /** The total number of tests in the project. */ fun goalCount(): Long = goalCount.getRequired("goalCount") @@ -97,34 +108,54 @@ private constructor( fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId() = workspaceId /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId() = creatorId /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("description") + @ExcludeMissing + fun _description() = description /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("source") + @ExcludeMissing + fun _source() = source /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + @JsonProperty("taskType") + @ExcludeMissing + fun _taskType() = taskType /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount() = versionCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -132,7 +163,9 @@ private constructor( fun _inferencePipelineCount() = inferencePipelineCount /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + @JsonProperty("goalCount") + @ExcludeMissing + fun _goalCount() = goalCount /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -145,9 +178,13 @@ private constructor( fun _monitoringGoalCount() = monitoringGoalCount /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") + @ExcludeMissing + fun _links() = links - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") + @ExcludeMissing + fun _gitRepo() = gitRepo @JsonAnyGetter @ExcludeMissing @@ -155,85 +192,84 @@ private constructor( 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 + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + links().validate() + gitRepo().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCreateResponse && - this.id == other.id && - this.workspaceId == other.workspaceId && - this.creatorId == other.creatorId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.source == other.source && - this.taskType == other.taskType && - this.versionCount == other.versionCount && - this.inferencePipelineCount == other.inferencePipelineCount && - this.goalCount == other.goalCount && - this.developmentGoalCount == other.developmentGoalCount && - this.monitoringGoalCount == other.monitoringGoalCount && - this.links == other.links && - this.gitRepo == other.gitRepo && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectCreateResponse && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.links == other.links && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -281,7 +317,11 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { + this.id = id + } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) @@ -289,7 +329,9 @@ private constructor( /** The workspace id. */ @JsonProperty("workspaceId") @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } /** The project creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -297,7 +339,9 @@ private constructor( /** The project creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + fun creatorId(creatorId: JsonField) = apply { + this.creatorId = creatorId + } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) @@ -305,7 +349,9 @@ private constructor( /** The project name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun name(name: JsonField) = apply { + this.name = name + } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -333,7 +379,9 @@ private constructor( /** The project description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonField) = apply { this.description = description } + fun description(description: JsonField) = apply { + this.description = description + } /** The source of the project. */ fun source(source: Source) = source(JsonField.of(source)) @@ -341,7 +389,9 @@ private constructor( /** The source of the project. */ @JsonProperty("source") @ExcludeMissing - fun source(source: JsonField) = apply { this.source = source } + fun source(source: JsonField) = apply { + this.source = source + } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) @@ -349,7 +399,9 @@ private constructor( /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing - fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + fun taskType(taskType: JsonField) = apply { + this.taskType = taskType + } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) @@ -357,11 +409,12 @@ private constructor( /** The number of versions (commits) in the project. */ @JsonProperty("versionCount") @ExcludeMissing - fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } + fun versionCount(versionCount: JsonField) = apply { + this.versionCount = versionCount + } /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) + fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -376,11 +429,12 @@ private constructor( /** The total number of tests in the project. */ @JsonProperty("goalCount") @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + 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)) + fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -390,8 +444,7 @@ private constructor( } /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @@ -406,13 +459,17 @@ private constructor( /** Links to the project. */ @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun links(links: JsonField) = apply { + this.links = links + } fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @ExcludeMissing - fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } + fun gitRepo(gitRepo: JsonField) = apply { + this.gitRepo = gitRepo + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -428,36 +485,31 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCreateResponse = - ProjectCreateResponse( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateResponse = ProjectCreateResponse( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -465,7 +517,9 @@ private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") + @ExcludeMissing + fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -473,35 +527,36 @@ private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -519,7 +574,9 @@ private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { this.app = app } + fun app(app: JsonField) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -539,20 +596,18 @@ private constructor( } } - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && this.value == other.value + return other is Source && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -583,39 +638,35 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && this.value == other.value + return other is TaskType && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -650,44 +701,42 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo - 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, + class GitRepo 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, + ) { private var validated: Boolean = false @@ -718,29 +767,53 @@ private constructor( fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("gitId") + @ExcludeMissing + fun _gitId() = gitId - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected() = dateConnected - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("branch") + @ExcludeMissing + fun _branch() = branch - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") + @ExcludeMissing + fun _private_() = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("slug") + @ExcludeMissing + fun _slug() = slug - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("url") + @ExcludeMissing + fun _url() = url - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("rootDir") + @ExcludeMissing + fun _rootDir() = rootDir - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId() = projectId - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId() = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -748,73 +821,72 @@ private constructor( fun validate(): GitRepo = apply { if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -854,16 +926,19 @@ private constructor( @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + 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 gitId(gitId: JsonField) = apply { + this.gitId = gitId + } - fun dateConnected(dateConnected: OffsetDateTime) = - dateConnected(JsonField.of(dateConnected)) + fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) @JsonProperty("dateConnected") @ExcludeMissing @@ -883,43 +958,57 @@ private constructor( @JsonProperty("branch") @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun branch(branch: JsonField) = apply { + this.branch = branch + } fun name(name: String) = name(JsonField.of(name)) @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + 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 private_(private_: JsonField) = apply { + this.private_ = private_ + } fun slug(slug: String) = slug(JsonField.of(slug)) @JsonProperty("slug") @ExcludeMissing - fun slug(slug: JsonField) = apply { this.slug = slug } + 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 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 rootDir(rootDir: JsonField) = apply { + this.rootDir = rootDir + } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun projectId(projectId: JsonField) = apply { + this.projectId = projectId + } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) @@ -943,22 +1032,21 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GitRepo = - GitRepo( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties.toUnmodifiable(), - ) + fun build(): GitRepo = GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties.toUnmodifiable(), + ) } } } 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 cab7c08..9b2a6e5 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 @@ -5,27 +5,45 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class ProjectInferencePipelineCreateParams -constructor( - private val projectId: String, - private val description: String?, - private val name: String, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class ProjectInferencePipelineCreateParams constructor( + private val projectId: String, + private val description: String?, + private val name: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun projectId(): String = projectId @@ -36,40 +54,39 @@ constructor( @JvmSynthetic internal fun getBody(): ProjectInferencePipelineCreateBody { - return ProjectInferencePipelineCreateBody( - description, - name, - additionalBodyProperties, - ) + return ProjectInferencePipelineCreateBody( + description, + name, + additionalBodyProperties, + ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic + internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } @JsonDeserialize(builder = ProjectInferencePipelineCreateBody.Builder::class) @NoAutoDetect - class ProjectInferencePipelineCreateBody - internal constructor( - private val description: String?, - private val name: String?, - private val additionalProperties: Map, - ) { + class ProjectInferencePipelineCreateBody internal constructor(private val description: String?, private val name: String?, private val additionalProperties: Map, ) { private var hashCode: Int = 0 /** The inference pipeline description. */ - @JsonProperty("description") fun description(): String? = description + @JsonProperty("description") + fun description(): String? = description /** The inference pipeline name. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") + fun name(): String? = name @JsonAnyGetter @ExcludeMissing @@ -78,34 +95,33 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateBody && - this.description == other.description && - this.name == other.name && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateBody && + this.description == other.description && + this.name == other.name && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - description, - name, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + description, + name, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" + override fun toString() = "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -115,9 +131,7 @@ constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody - ) = apply { + internal fun from(projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody) = apply { this.description = projectInferencePipelineCreateBody.description this.name = projectInferencePipelineCreateBody.name additionalProperties(projectInferencePipelineCreateBody.additionalProperties) @@ -125,10 +139,15 @@ constructor( /** The inference pipeline description. */ @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String) = apply { + this.description = description + } /** The inference pipeline name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + @JsonProperty("name") + fun name(name: String) = apply { + this.name = name + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -144,12 +163,13 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineCreateBody = - ProjectInferencePipelineCreateBody( - description, - checkNotNull(name) { "`name` is required but was not set" }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateBody = ProjectInferencePipelineCreateBody( + description, + checkNotNull(name) { + "`name` is required but was not set" + }, + additionalProperties.toUnmodifiable(), + ) } } @@ -160,38 +180,38 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateParams && - this.projectId == other.projectId && - this.description == other.description && - this.name == other.name && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateParams && + this.projectId == other.projectId && + this.description == other.description && + this.name == other.name && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectId, - description, - name, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectId, + description, + name, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -205,9 +225,7 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams - ) = apply { + internal fun from(projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams) = apply { this.projectId = projectInferencePipelineCreateParams.projectId this.description = projectInferencePipelineCreateParams.description this.name = projectInferencePipelineCreateParams.name @@ -216,13 +234,19 @@ constructor( additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) } - fun projectId(projectId: String) = apply { this.projectId = projectId } + 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 { + this.description = description + } /** The inference pipeline name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { + this.name = name + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -262,7 +286,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -273,33 +299,32 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): ProjectInferencePipelineCreateParams = - ProjectInferencePipelineCreateParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, - description, - checkNotNull(name) { "`name` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateParams = ProjectInferencePipelineCreateParams( + checkNotNull(projectId) { + "`projectId` is required but was not set" + }, + description, + checkNotNull(name) { + "`name` is required but was not set" + }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: String?, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: String?, private val additionalProperties: Map, ) { private var hashCode: Int = 0 - @JsonProperty("app") fun app(): String? = app + @JsonProperty("app") + fun app(): String? = app @JsonAnyGetter @ExcludeMissing @@ -308,27 +333,28 @@ constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -342,7 +368,10 @@ constructor( additionalProperties(links.additionalProperties) } - @JsonProperty("app") fun app(app: String) = apply { this.app = app } + @JsonProperty("app") + fun app(app: String) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -358,28 +387,24 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() - ) + fun build(): Links = Links(checkNotNull(app) { + "`app` is required but was not set" + }, additionalProperties.toUnmodifiable()) } } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -422,27 +447,25 @@ constructor( _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 acd34bb..c6b8166 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 @@ -5,40 +5,54 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional @JsonDeserialize(builder = ProjectInferencePipelineCreateResponse.Builder::class) @NoAutoDetect -class ProjectInferencePipelineCreateResponse -private constructor( - private val id: JsonField, - private val projectId: 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, +class ProjectInferencePipelineCreateResponse private constructor( + private val id: JsonField, + private val projectId: 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, + ) { private var validated: Boolean = false @@ -61,20 +75,16 @@ private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The last data sample received date. */ - fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) /** The inference pipeline description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -89,25 +99,34 @@ private constructor( fun status(): Status = status.getRequired("status") /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) fun links(): Links = links.getRequired("links") /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId() = projectId /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -115,10 +134,14 @@ private constructor( fun _dateLastSampleReceived() = dateLastSampleReceived /** The inference pipeline description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("description") + @ExcludeMissing + fun _description() = description /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated() = dateLastEvaluated /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -126,21 +149,33 @@ private constructor( fun _dateOfNextEvaluation() = dateOfNextEvaluation /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount() = passingGoalCount /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount() = failingGoalCount /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount() = totalGoalCount /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") + @ExcludeMissing + fun _status() = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage() = statusMessage - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") + @ExcludeMissing + fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -148,82 +183,81 @@ private constructor( fun validate(): ProjectInferencePipelineCreateResponse = apply { if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateResponse && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, 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}" + override fun toString() = "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -246,16 +280,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse - ) = apply { + internal fun from(projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse) = apply { this.id = projectInferencePipelineCreateResponse.id this.projectId = projectInferencePipelineCreateResponse.projectId this.name = projectInferencePipelineCreateResponse.name this.dateCreated = projectInferencePipelineCreateResponse.dateCreated this.dateUpdated = projectInferencePipelineCreateResponse.dateUpdated - this.dateLastSampleReceived = - projectInferencePipelineCreateResponse.dateLastSampleReceived + this.dateLastSampleReceived = projectInferencePipelineCreateResponse.dateLastSampleReceived this.description = projectInferencePipelineCreateResponse.description this.dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated this.dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation @@ -272,7 +303,11 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { + this.id = id + } /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @@ -280,7 +315,9 @@ private constructor( /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun projectId(projectId: JsonField) = apply { + this.projectId = projectId + } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) @@ -288,7 +325,9 @@ private constructor( /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun name(name: JsonField) = apply { + this.name = name + } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -311,8 +350,7 @@ private constructor( } /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = - dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -327,11 +365,12 @@ private constructor( /** The inference pipeline description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonField) = apply { this.description = description } + fun description(description: JsonField) = apply { + this.description = description + } /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = - dateLastEvaluated(JsonField.of(dateLastEvaluated)) + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = dateLastEvaluated(JsonField.of(dateLastEvaluated)) /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -341,8 +380,7 @@ private constructor( } /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -352,8 +390,7 @@ private constructor( } /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ @JsonProperty("passingGoalCount") @@ -363,8 +400,7 @@ private constructor( } /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests failing. */ @JsonProperty("failingGoalCount") @@ -389,7 +425,9 @@ private constructor( /** The status of test evaluation for the inference pipeline. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + 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)) @@ -405,7 +443,9 @@ private constructor( @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun links(links: JsonField) = apply { + this.links = links + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -421,34 +461,29 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineCreateResponse = - ProjectInferencePipelineCreateResponse( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateResponse = ProjectInferencePipelineCreateResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -456,7 +491,9 @@ private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") + @ExcludeMissing + fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -464,35 +501,36 @@ private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -510,7 +548,9 @@ private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { this.app = app } + fun app(app: JsonField) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -530,20 +570,18 @@ private constructor( } } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -586,27 +624,25 @@ private constructor( _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 1b909ab..b5ed45c 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 @@ -2,22 +2,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.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow +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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class ProjectInferencePipelineListParams -constructor( - private val projectId: String, - private val name: String?, - private val page: Long?, - private val perPage: Long?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class ProjectInferencePipelineListParams constructor( + private val projectId: String, + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun projectId(): String = projectId @@ -30,21 +57,28 @@ constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.name?.let { params.put("name", listOf(it.toString())) } - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.name?.let { + params.put("name", listOf(it.toString())) + } + this.page?.let { + params.put("page", listOf(it.toString())) + } + this.perPage?.let { + params.put("perPage", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -54,40 +88,40 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListParams && - this.projectId == other.projectId && - this.name == other.name && - this.page == other.page && - this.perPage == other.perPage && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListParams && + this.projectId == other.projectId && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectId, - name, - page, - perPage, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectId, + name, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -102,29 +136,34 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = - apply { - this.projectId = projectInferencePipelineListParams.projectId - this.name = projectInferencePipelineListParams.name - this.page = projectInferencePipelineListParams.page - this.perPage = projectInferencePipelineListParams.perPage - additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) - additionalHeaders(projectInferencePipelineListParams.additionalHeaders) - additionalBodyProperties( - projectInferencePipelineListParams.additionalBodyProperties - ) - } - - fun projectId(projectId: String) = apply { this.projectId = projectId } + internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = apply { + this.projectId = projectInferencePipelineListParams.projectId + this.name = projectInferencePipelineListParams.name + this.page = projectInferencePipelineListParams.page + this.perPage = projectInferencePipelineListParams.perPage + additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineListParams.additionalHeaders) + additionalBodyProperties(projectInferencePipelineListParams.additionalBodyProperties) + } + + 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 + } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + fun page(page: Long) = apply { + this.page = page + } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long) = apply { + this.perPage = perPage + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -164,7 +203,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -175,20 +216,20 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectInferencePipelineListParams = - ProjectInferencePipelineListParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, - name, - page, - perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectInferencePipelineListParams = ProjectInferencePipelineListParams( + checkNotNull(projectId) { + "`projectId` is required but was not set" + }, + name, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } 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 cb9e840..5a96dcc 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 @@ -5,28 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional @JsonDeserialize(builder = ProjectInferencePipelineListResponse.Builder::class) @NoAutoDetect -class ProjectInferencePipelineListResponse -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { +class ProjectInferencePipelineListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -36,9 +45,13 @@ private constructor( fun items(): List = items.getRequired("items") - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + @JsonProperty("_meta") + @ExcludeMissing + fun __meta() = _meta - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") + @ExcludeMissing + fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -46,43 +59,42 @@ private constructor( fun validate(): ProjectInferencePipelineListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -92,9 +104,7 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineListResponse: ProjectInferencePipelineListResponse - ) = apply { + internal fun from(projectInferencePipelineListResponse: ProjectInferencePipelineListResponse) = apply { this._meta = projectInferencePipelineListResponse._meta this.items = projectInferencePipelineListResponse.items additionalProperties(projectInferencePipelineListResponse.additionalProperties) @@ -104,13 +114,17 @@ private constructor( @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun _meta(_meta: JsonField<_Meta>) = apply { + this._meta = _meta + } 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 + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -126,23 +140,22 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineListResponse = - ProjectInferencePipelineListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineListResponse = ProjectInferencePipelineListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, + class _Meta private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -162,16 +175,24 @@ private constructor( fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page + @JsonProperty("page") + @ExcludeMissing + fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + @JsonProperty("perPage") + @ExcludeMissing + fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + @JsonProperty("totalItems") + @ExcludeMissing + fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + @JsonProperty("totalPages") + @ExcludeMissing + fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -179,49 +200,48 @@ private constructor( fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -247,7 +267,9 @@ private constructor( /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } + fun page(page: JsonField) = apply { + this.page = page + } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -255,7 +277,9 @@ private constructor( /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + fun perPage(perPage: JsonField) = apply { + this.perPage = perPage + } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -263,7 +287,9 @@ private constructor( /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + fun totalItems(totalItems: JsonField) = apply { + this.totalItems = totalItems + } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -271,7 +297,9 @@ private constructor( /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + fun totalPages(totalPages: JsonField) = apply { + this.totalPages = totalPages + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -287,37 +315,36 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item - private constructor( - private val id: JsonField, - private val projectId: 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, + class Item private constructor( + private val id: JsonField, + private val projectId: 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, + ) { private var validated: Boolean = false @@ -340,20 +367,16 @@ private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The last data sample received date. */ - fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) /** The inference pipeline description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -368,25 +391,34 @@ private constructor( fun status(): Status = status.getRequired("status") /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) fun links(): Links = links.getRequired("links") /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId() = projectId /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -394,7 +426,9 @@ private constructor( fun _dateLastSampleReceived() = dateLastSampleReceived /** The inference pipeline description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("description") + @ExcludeMissing + fun _description() = description /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -407,21 +441,33 @@ private constructor( fun _dateOfNextEvaluation() = dateOfNextEvaluation /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount() = passingGoalCount /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount() = failingGoalCount /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount() = totalGoalCount /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") + @ExcludeMissing + fun _status() = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage() = statusMessage - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") + @ExcludeMissing + fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -429,82 +475,81 @@ private constructor( fun validate(): Item = apply { if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "Item{id=$id, projectId=$projectId, 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}" + override fun toString() = "Item{id=$id, projectId=$projectId, 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -552,7 +597,9 @@ private constructor( /** 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)) @@ -560,7 +607,9 @@ private constructor( /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun projectId(projectId: JsonField) = apply { + this.projectId = projectId + } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) @@ -568,7 +617,9 @@ private constructor( /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun name(name: JsonField) = apply { + this.name = name + } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -591,8 +642,7 @@ private constructor( } /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = - dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -612,8 +662,7 @@ private constructor( } /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = - dateLastEvaluated(JsonField.of(dateLastEvaluated)) + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = dateLastEvaluated(JsonField.of(dateLastEvaluated)) /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -623,8 +672,7 @@ private constructor( } /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -634,8 +682,7 @@ private constructor( } /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ @JsonProperty("passingGoalCount") @@ -645,8 +692,7 @@ private constructor( } /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests failing. */ @JsonProperty("failingGoalCount") @@ -671,7 +717,9 @@ private constructor( /** The status of test evaluation for the inference pipeline. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + 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)) @@ -687,7 +735,9 @@ private constructor( @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun links(links: JsonField) = apply { + this.links = links + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -703,34 +753,29 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = - Item( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = Item( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -738,7 +783,9 @@ private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") + @ExcludeMissing + fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -746,35 +793,36 @@ private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -792,7 +840,9 @@ private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { this.app = app } + fun app(app: JsonField) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -804,29 +854,26 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && this.value == other.value + return other is Status && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -869,27 +916,25 @@ private constructor( _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 b493cd2..bd79a95 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 @@ -2,26 +2,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.openlayer.api.core.Enum +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow +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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class ProjectListParams -constructor( - private val name: String?, - private val page: Long?, - private val perPage: Long?, - private val taskType: TaskType?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class ProjectListParams constructor( + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val taskType: TaskType?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun name(): Optional = Optional.ofNullable(name) @@ -34,16 +57,25 @@ constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.name?.let { params.put("name", listOf(it.toString())) } - this.page?.let { params.put("page", listOf(it.toString())) } - this.perPage?.let { params.put("perPage", listOf(it.toString())) } - this.taskType?.let { params.put("taskType", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.name?.let { + params.put("name", listOf(it.toString())) + } + this.page?.let { + params.put("page", listOf(it.toString())) + } + this.perPage?.let { + params.put("perPage", listOf(it.toString())) + } + this.taskType?.let { + params.put("taskType", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams @@ -52,40 +84,40 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectListParams && - this.name == other.name && - this.page == other.page && - this.perPage == other.perPage && - this.taskType == other.taskType && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectListParams && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.taskType == other.taskType && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - name, - page, - perPage, - taskType, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + name, + page, + perPage, + taskType, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "ProjectListParams{name=$name, page=$page, perPage=$perPage, taskType=$taskType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "ProjectListParams{name=$name, page=$page, perPage=$perPage, taskType=$taskType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -111,16 +143,24 @@ constructor( } /** Filter list of items by project name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { + this.name = name + } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + fun page(page: Long) = apply { + this.page = page + } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long) = apply { + this.perPage = perPage + } /** Filter list of items by task type. */ - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + fun taskType(taskType: TaskType) = apply { + this.taskType = taskType + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -160,7 +200,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -171,37 +213,33 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectListParams = - ProjectListParams( - name, - page, - perPage, - taskType, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectListParams = ProjectListParams( + name, + page, + perPage, + taskType, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && this.value == other.value + return other is TaskType && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -236,23 +274,21 @@ constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun value(): Value = when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } + + fun known(): Known = when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } 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 69c6387..f6e8e92 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 @@ -5,28 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect 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 -private constructor( - private val _meta: JsonField<_Meta>, - private val items: JsonField>, - private val additionalProperties: Map, -) { +class ProjectListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -36,9 +45,13 @@ private constructor( fun items(): List = items.getRequired("items") - @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + @JsonProperty("_meta") + @ExcludeMissing + fun __meta() = _meta - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") + @ExcludeMissing + fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -46,43 +59,42 @@ private constructor( fun validate(): ProjectListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "ProjectListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = "ProjectListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -102,13 +114,17 @@ private constructor( @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun _meta(_meta: JsonField<_Meta>) = apply { + this._meta = _meta + } 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 + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -124,23 +140,22 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectListResponse = - ProjectListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectListResponse = ProjectListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, + class _Meta private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -160,16 +175,24 @@ private constructor( fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") @ExcludeMissing fun _page() = page + @JsonProperty("page") + @ExcludeMissing + fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + @JsonProperty("perPage") + @ExcludeMissing + fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + @JsonProperty("totalItems") + @ExcludeMissing + fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + @JsonProperty("totalPages") + @ExcludeMissing + fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -177,49 +200,48 @@ private constructor( fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -245,7 +267,9 @@ private constructor( /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { this.page = page } + fun page(page: JsonField) = apply { + this.page = page + } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -253,7 +277,9 @@ private constructor( /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + fun perPage(perPage: JsonField) = apply { + this.perPage = perPage + } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -261,7 +287,9 @@ private constructor( /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + fun totalItems(totalItems: JsonField) = apply { + this.totalItems = totalItems + } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -269,7 +297,9 @@ private constructor( /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + fun totalPages(totalPages: JsonField) = apply { + this.totalPages = totalPages + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -285,38 +315,37 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = - _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item - 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, + class Item 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, + ) { private var validated: Boolean = false @@ -327,8 +356,7 @@ private constructor( fun id(): String = id.getRequired("id") /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) @@ -343,8 +371,7 @@ private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -356,8 +383,7 @@ private constructor( fun versionCount(): Long = versionCount.getRequired("versionCount") /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") + fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") /** The total number of tests in the project. */ fun goalCount(): Long = goalCount.getRequired("goalCount") @@ -374,34 +400,54 @@ private constructor( fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId() = workspaceId /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId() = creatorId /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated() = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("description") + @ExcludeMissing + fun _description() = description /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("source") + @ExcludeMissing + fun _source() = source /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + @JsonProperty("taskType") + @ExcludeMissing + fun _taskType() = taskType /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount() = versionCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -409,7 +455,9 @@ private constructor( fun _inferencePipelineCount() = inferencePipelineCount /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + @JsonProperty("goalCount") + @ExcludeMissing + fun _goalCount() = goalCount /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -422,9 +470,13 @@ private constructor( fun _monitoringGoalCount() = monitoringGoalCount /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") + @ExcludeMissing + fun _links() = links - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") + @ExcludeMissing + fun _gitRepo() = gitRepo @JsonAnyGetter @ExcludeMissing @@ -432,85 +484,84 @@ private constructor( 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 + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + links().validate() + gitRepo().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.workspaceId == other.workspaceId && - this.creatorId == other.creatorId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.source == other.source && - this.taskType == other.taskType && - this.versionCount == other.versionCount && - this.inferencePipelineCount == other.inferencePipelineCount && - this.goalCount == other.goalCount && - this.developmentGoalCount == other.developmentGoalCount && - this.monitoringGoalCount == other.monitoringGoalCount && - this.links == other.links && - this.gitRepo == other.gitRepo && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.links == other.links && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -560,7 +611,9 @@ private constructor( /** The project id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { + this.id = id + } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) @@ -578,7 +631,9 @@ private constructor( /** The project creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + fun creatorId(creatorId: JsonField) = apply { + this.creatorId = creatorId + } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) @@ -586,7 +641,9 @@ private constructor( /** The project name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun name(name: JsonField) = apply { + this.name = name + } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -624,7 +681,9 @@ private constructor( /** The source of the project. */ @JsonProperty("source") @ExcludeMissing - fun source(source: JsonField) = apply { this.source = source } + fun source(source: JsonField) = apply { + this.source = source + } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) @@ -632,7 +691,9 @@ private constructor( /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing - fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + fun taskType(taskType: JsonField) = apply { + this.taskType = taskType + } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) @@ -645,8 +706,7 @@ private constructor( } /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) + fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -661,11 +721,12 @@ private constructor( /** The total number of tests in the project. */ @JsonProperty("goalCount") @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + 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)) + fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -675,8 +736,7 @@ private constructor( } /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @@ -691,13 +751,17 @@ private constructor( /** Links to the project. */ @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun links(links: JsonField) = apply { + this.links = links + } fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @ExcludeMissing - fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } + fun gitRepo(gitRepo: JsonField) = apply { + this.gitRepo = gitRepo + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -713,36 +777,31 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = - Item( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = Item( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { + class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -750,7 +809,9 @@ private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") + @ExcludeMissing + fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -758,35 +819,36 @@ private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -804,7 +866,9 @@ private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { this.app = app } + fun app(app: JsonField) = apply { + this.app = app + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -816,29 +880,26 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } } - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && this.value == other.value + return other is Source && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -869,39 +930,35 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && this.value == other.value + return other is TaskType && + this.value == other.value } override fun hashCode() = value.hashCode() @@ -912,8 +969,7 @@ private constructor( @JvmField val LLM_BASE = TaskType(JsonField.of("llm-base")) - @JvmField - val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) + @JvmField val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) @JvmField val TABULAR_REGRESSION = TaskType(JsonField.of("tabular-regression")) @@ -937,44 +993,42 @@ private constructor( _UNKNOWN, } - fun value(): Value = - when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = - when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo - 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, + class GitRepo 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, + ) { private var validated: Boolean = false @@ -1005,29 +1059,53 @@ private constructor( fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") + @ExcludeMissing + fun _id() = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("gitId") + @ExcludeMissing + fun _gitId() = gitId - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected() = dateConnected - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated() = dateUpdated - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("branch") + @ExcludeMissing + fun _branch() = branch - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") + @ExcludeMissing + fun _name() = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") + @ExcludeMissing + fun _private_() = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("slug") + @ExcludeMissing + fun _slug() = slug - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("url") + @ExcludeMissing + fun _url() = url - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("rootDir") + @ExcludeMissing + fun _rootDir() = rootDir - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId() = projectId - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId() = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -1035,73 +1113,72 @@ private constructor( fun validate(): GitRepo = apply { if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -1141,16 +1218,19 @@ private constructor( @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } + 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 gitId(gitId: JsonField) = apply { + this.gitId = gitId + } - fun dateConnected(dateConnected: OffsetDateTime) = - dateConnected(JsonField.of(dateConnected)) + fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) @JsonProperty("dateConnected") @ExcludeMissing @@ -1158,8 +1238,7 @@ private constructor( this.dateConnected = dateConnected } - fun dateUpdated(dateUpdated: OffsetDateTime) = - dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) @JsonProperty("dateUpdated") @ExcludeMissing @@ -1171,43 +1250,57 @@ private constructor( @JsonProperty("branch") @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun branch(branch: JsonField) = apply { + this.branch = branch + } fun name(name: String) = name(JsonField.of(name)) @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + 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 private_(private_: JsonField) = apply { + this.private_ = private_ + } fun slug(slug: String) = slug(JsonField.of(slug)) @JsonProperty("slug") @ExcludeMissing - fun slug(slug: JsonField) = apply { this.slug = slug } + 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 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 rootDir(rootDir: JsonField) = apply { + this.rootDir = rootDir + } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun projectId(projectId: JsonField) = apply { + this.projectId = projectId + } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) @@ -1227,27 +1320,25 @@ private constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): GitRepo = - GitRepo( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties.toUnmodifiable(), - ) + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GitRepo = GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties.toUnmodifiable(), + ) } } } 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 e5085a5..86d7d09 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 @@ -2,37 +2,67 @@ 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.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.apache.hc.core5.http.ContentType +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow +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.MultipartFormValue import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* -import java.util.Objects -import java.util.Optional -class StoragePresignedUrlCreateParams -constructor( - private val objectName: String, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, +class StoragePresignedUrlCreateParams constructor( + private val objectName: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, + ) { fun objectName(): String = objectName @JvmSynthetic internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.objectName.let { params.put("objectName", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.objectName.let { + params.put("objectName", listOf(it.toString())) + } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic + internal fun getHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams @@ -41,34 +71,34 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StoragePresignedUrlCreateParams && - this.objectName == other.objectName && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateParams && + this.objectName == other.objectName && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - objectName, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + objectName, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = - "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } @NoAutoDetect @@ -80,16 +110,17 @@ constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = - apply { - this.objectName = storagePresignedUrlCreateParams.objectName - additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) - additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) - additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) - } + internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = apply { + this.objectName = storagePresignedUrlCreateParams.objectName + additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) + additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) + additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) + } /** The name of the object. */ - fun objectName(objectName: String) = apply { this.objectName = objectName } + fun objectName(objectName: String) = apply { + this.objectName = objectName + } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -129,7 +160,9 @@ constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeHeader(name: String) = apply { + this.additionalHeaders.put(name, mutableListOf()) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -140,17 +173,17 @@ constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): StoragePresignedUrlCreateParams = - StoragePresignedUrlCreateParams( - checkNotNull(objectName) { "`objectName` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): StoragePresignedUrlCreateParams = StoragePresignedUrlCreateParams( + checkNotNull(objectName) { + "`objectName` is required but was not set" + }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } 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 57c2fca..cdccfb8 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,24 +4,43 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import java.util.UUID +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.getOrThrow 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.JsonNull +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Enum import com.openlayer.api.core.toUnmodifiable -import java.util.Objects +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException @JsonDeserialize(builder = StoragePresignedUrlCreateResponse.Builder::class) @NoAutoDetect -class StoragePresignedUrlCreateResponse -private constructor( - private val url: JsonField, - private val fields: JsonValue, - private val storageUri: JsonField, - private val additionalProperties: Map, +class StoragePresignedUrlCreateResponse private constructor( + private val url: JsonField, + private val fields: JsonValue, + private val storageUri: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -35,13 +54,19 @@ private constructor( fun storageUri(): String = storageUri.getRequired("storageUri") /** The presigned url. */ - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("url") + @ExcludeMissing + fun _url() = 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() = 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() = storageUri @JsonAnyGetter @ExcludeMissing @@ -49,45 +74,44 @@ private constructor( fun validate(): StoragePresignedUrlCreateResponse = apply { if (!validated) { - url() - storageUri() - validated = true + url() + storageUri() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StoragePresignedUrlCreateResponse && - this.url == other.url && - this.fields == other.fields && - this.storageUri == other.storageUri && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateResponse && + this.url == other.url && + this.fields == other.fields && + this.storageUri == other.storageUri && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - url, - fields, - storageUri, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash( + url, + fields, + storageUri, + additionalProperties, + ) + } + return hashCode } - override fun toString() = - "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" + override fun toString() = "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" companion object { - @JvmStatic fun builder() = Builder() + @JvmStatic + fun builder() = Builder() } class Builder { @@ -98,13 +122,12 @@ private constructor( 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) - } + internal fun from(storagePresignedUrlCreateResponse: StoragePresignedUrlCreateResponse) = apply { + this.url = storagePresignedUrlCreateResponse.url + this.fields = storagePresignedUrlCreateResponse.fields + this.storageUri = storagePresignedUrlCreateResponse.storageUri + additionalProperties(storagePresignedUrlCreateResponse.additionalProperties) + } /** The presigned url. */ fun url(url: String) = url(JsonField.of(url)) @@ -112,12 +135,16 @@ private constructor( /** The presigned url. */ @JsonProperty("url") @ExcludeMissing - fun url(url: JsonField) = apply { this.url = url } + 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 } + 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)) @@ -125,7 +152,9 @@ private constructor( /** 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 storageUri(storageUri: JsonField) = apply { + this.storageUri = storageUri + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -141,12 +170,11 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): StoragePresignedUrlCreateResponse = - StoragePresignedUrlCreateResponse( - url, - fields, - storageUri, - additionalProperties.toUnmodifiable(), - ) + fun build(): StoragePresignedUrlCreateResponse = StoragePresignedUrlCreateResponse( + url, + fields, + storageUri, + additionalProperties.toUnmodifiable(), + ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt index 357020c..4ebcf64 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt @@ -2,33 +2,37 @@ package com.openlayer.api.services +import java.io.InputStream +import java.io.OutputStream import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.openlayer.api.core.http.BinaryResponseContent 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.core.http.BinaryResponseContent import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.errors.OpenlayerException +import com.openlayer.api.errors.OpenlayerServiceException +import com.openlayer.api.errors.InternalServerException +import com.openlayer.api.errors.BadRequestException +import com.openlayer.api.errors.NotFoundException 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.InputStream -import java.io.OutputStream -@JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandler +@JvmSynthetic +internal fun emptyHandler(): Handler = EmptyHandler private object EmptyHandler : Handler { override fun handle(response: HttpResponse): Void? = null } -@JvmSynthetic internal fun stringHandler(): Handler = StringHandler +@JvmSynthetic +internal fun stringHandler(): Handler = StringHandler -@JvmSynthetic internal fun binaryHandler(): Handler = BinaryHandler +@JvmSynthetic +internal fun binaryHandler(): Handler = BinaryHandler private object StringHandler : Handler { override fun handle(response: HttpResponse): String { @@ -38,7 +42,7 @@ private object StringHandler : Handler { private object BinaryHandler : Handler { override fun handle(response: HttpResponse): BinaryResponseContent { - return BinaryResponseContentImpl(response) + return BinaryResponseContentImpl(response); } } @@ -77,19 +81,10 @@ internal fun Handler.withErrorHandler(errorHandler: Handler return this@withErrorHandler.handle(response) 400 -> throw BadRequestException(response.headers(), errorHandler.handle(response)) - 401 -> - throw UnauthorizedException(response.headers(), errorHandler.handle(response)) - 403 -> - throw PermissionDeniedException( - response.headers(), - errorHandler.handle(response) - ) + 401 -> throw UnauthorizedException(response.headers(), errorHandler.handle(response)) + 403 -> throw PermissionDeniedException(response.headers(), errorHandler.handle(response)) 404 -> throw NotFoundException(response.headers(), errorHandler.handle(response)) - 422 -> - throw UnprocessableEntityException( - response.headers(), - errorHandler.handle(response) - ) + 422 -> throw UnprocessableEntityException(response.headers(), errorHandler.handle(response)) 429 -> throw RateLimitException(response.headers(), errorHandler.handle(response)) in 500..599 -> throw InternalServerException( @@ -110,21 +105,22 @@ internal fun Handler.withErrorHandler(errorHandler: Handler json( @@ -50,10 +50,7 @@ internal inline fun json( } @JvmSynthetic -internal fun multipartFormData( - jsonMapper: JsonMapper, - parts: Array?> -): HttpRequestBody { +internal fun multipartFormData(jsonMapper: JsonMapper, parts: Array?>): HttpRequestBody { val builder = MultipartEntityBuilder.create() parts.forEach { part -> if (part?.value != null) { @@ -65,30 +62,16 @@ internal fun multipartFormData( } catch (e: Exception) { throw OpenlayerException("Error serializing value to json", e) } - builder.addBinaryBody( - part.name, - buffer.toByteArray(), - part.contentType, - part.filename - ) + 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 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 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}" - ) + else -> throw IllegalArgumentException("Unsupported content type: ${part.value::class.java.simpleName}") } } } 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 92fd5e9..a3626b2 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 @@ -4,7 +4,41 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.commits.TestResultServiceAsync +import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl interface CommitServiceAsync { 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 ef73e6d..e9b4b48 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 @@ -2,23 +2,47 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl -import com.openlayer.api.services.errorHandler -class CommitServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : CommitServiceAsync { +class CommitServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val testResults: TestResultServiceAsync by lazy { - TestResultServiceAsyncImpl(clientOptions) - } + private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } override fun testResults(): TestResultServiceAsync = testResults } 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 b4419d4..567e05e 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 @@ -4,9 +4,45 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler 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 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 5518aff..79cb3f9 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 @@ -2,21 +2,47 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler 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.services.errorHandler -class InferencePipelineServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineServiceAsync { +class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -24,9 +50,7 @@ constructor( private val rows: RowServiceAsync by lazy { RowServiceAsyncImpl(clientOptions) } - private val testResults: TestResultServiceAsync by lazy { - TestResultServiceAsyncImpl(clientOptions) - } + private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } override fun data(): DataServiceAsync = data 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 bc149ca..91eb662 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 @@ -4,14 +4,47 @@ package com.openlayer.api.services.async -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException 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.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler 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 java.util.concurrent.CompletableFuture +import com.openlayer.api.services.async.projects.InferencePipelineServiceAsyncImpl interface ProjectServiceAsync { @@ -21,15 +54,9 @@ interface ProjectServiceAsync { /** Create a project in your workspace. */ @JvmOverloads - fun create( - params: ProjectCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + fun create(params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture /** List your workspace's projects. */ @JvmOverloads - fun list( - params: ProjectListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + fun list(params: ProjectListParams, requestOptions: RequestOptions = RequestOptions.none()): 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 b49f449..0b4a884 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 @@ -2,99 +2,112 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +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.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions 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.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.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture +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 -class ProjectServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : ProjectServiceAsync { +class ProjectServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : ProjectServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - private val inferencePipelines: InferencePipelineServiceAsync by lazy { - InferencePipelineServiceAsyncImpl(clientOptions) - } + private val inferencePipelines: InferencePipelineServiceAsync by lazy { InferencePipelineServiceAsyncImpl(clientOptions) } override fun commits(): CommitServiceAsync = commits override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create(params: ProjectCreateParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + createHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: ProjectListParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 6a59073..831de31 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 @@ -4,7 +4,41 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync +import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl interface StorageServiceAsync { 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 2dd732c..dac3cb2 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 @@ -2,23 +2,47 @@ package com.openlayer.api.services.async +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl -import com.openlayer.api.services.errorHandler -class StorageServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : StorageServiceAsync { +class StorageServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : StorageServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val presignedUrl: PresignedUrlServiceAsync by lazy { - PresignedUrlServiceAsyncImpl(clientOptions) - } + private val presignedUrl: PresignedUrlServiceAsync by lazy { PresignedUrlServiceAsyncImpl(clientOptions) } override fun presignedUrl(): PresignedUrlServiceAsync = 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 dde3ea2..a466cbe 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 @@ -4,17 +4,45 @@ package com.openlayer.api.services.async.commits -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface TestResultServiceAsync { /** List the test results for a project commit (project version). */ @JvmOverloads - fun list( - params: CommitTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 ac4c25f..a200f69 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 @@ -2,53 +2,70 @@ package com.openlayer.api.services.async.commits +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : TestResultServiceAsync { +class TestResultServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: CommitTestResultListParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 4f079ec..3fab390 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 @@ -4,17 +4,45 @@ package com.openlayer.api.services.async.inferencePipelines -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface DataServiceAsync { /** Publish an inference data point to an inference pipeline. */ @JvmOverloads - fun stream( - params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 bbbf784..23f28ed 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 @@ -2,55 +2,71 @@ package com.openlayer.api.services.async.inferencePipelines +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class DataServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : DataServiceAsync { +class DataServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { streamHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun stream(params: InferencePipelineDataStreamParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + streamHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 4522c37..40dfad8 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 @@ -4,17 +4,45 @@ package com.openlayer.api.services.async.inferencePipelines -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse -import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface RowServiceAsync { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun update( - params: InferencePipelineRowUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 9304fa7..8fe8680 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 @@ -2,55 +2,71 @@ package com.openlayer.api.services.async.inferencePipelines +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class RowServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : RowServiceAsync { +class RowServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : RowServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + updateHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 5d526af..7b0b75c 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 @@ -4,17 +4,45 @@ package com.openlayer.api.services.async.inferencePipelines -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface TestResultServiceAsync { /** List the latest test results for an inference pipeline. */ @JvmOverloads - fun list( - params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 0b4305b..3bdda30 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 @@ -2,53 +2,70 @@ package com.openlayer.api.services.async.inferencePipelines +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : TestResultServiceAsync { +class TestResultServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: InferencePipelineTestResultListParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 cc723f2..1157a3e 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 @@ -4,17 +4,45 @@ package com.openlayer.api.services.async.projects -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface CommitServiceAsync { /** List the commits (project versions) in a project. */ @JvmOverloads - fun list( - params: ProjectCommitListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 9fb60aa..8f74835 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 @@ -2,53 +2,70 @@ package com.openlayer.api.services.async.projects +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class CommitServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : CommitServiceAsync { +class CommitServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: ProjectCommitListParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 a0a6c63..f9abcdd 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 @@ -4,26 +4,51 @@ package com.openlayer.api.services.async.projects -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException 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 java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface InferencePipelineServiceAsync { /** Create an inference pipeline in a project. */ @JvmOverloads - fun create( - params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture /** List the inference pipelines in a project. */ @JvmOverloads - fun list( - params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 262589d..656838b 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 @@ -2,87 +2,100 @@ package com.openlayer.api.services.async.projects +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +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.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions 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.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class InferencePipelineServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineServiceAsync { +class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + createHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: ProjectInferencePipelineListParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions) + .thenApply { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 933abd8..3037188 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 @@ -4,17 +4,45 @@ package com.openlayer.api.services.async.storage -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse -import java.util.concurrent.CompletableFuture +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface PresignedUrlServiceAsync { /** Retrieve a presigned url to post storage artifacts. */ @JvmOverloads - fun create( - params: StoragePresignedUrlCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + 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 65a6972..d084d4a 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 @@ -2,55 +2,75 @@ package com.openlayer.api.services.async.storage +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -import java.util.concurrent.CompletableFuture -class PresignedUrlServiceAsyncImpl -constructor( - private val clientOptions: ClientOptions, -) : PresignedUrlServiceAsync { +class PresignedUrlServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : PresignedUrlServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .apply { params.getBody().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() - } - } + override fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions): CompletableFuture { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { + params.getBody().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() + } + } + } } } 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 86553e1..2399953 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 @@ -4,7 +4,41 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.commits.TestResultService +import com.openlayer.api.services.blocking.commits.TestResultServiceImpl 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 cae0abd..4def18e 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 @@ -2,17 +2,43 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl -import com.openlayer.api.services.errorHandler -class CommitServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : CommitService { +class CommitServiceImpl constructor(private val clientOptions: ClientOptions, ) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 157d71f..fc40959 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 @@ -4,9 +4,45 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler 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 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 2267d4a..562c292 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 @@ -2,21 +2,47 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler 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.services.errorHandler -class InferencePipelineServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineService { +class InferencePipelineServiceImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 a9e58d1..2cd51fd 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 @@ -4,13 +4,47 @@ package com.openlayer.api.services.blocking -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException 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.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler 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 interface ProjectService { @@ -20,15 +54,9 @@ interface ProjectService { /** Create a project in your workspace. */ @JvmOverloads - fun create( - params: ProjectCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectCreateResponse + fun create(params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectCreateResponse /** List your workspace's projects. */ @JvmOverloads - fun list( - params: ProjectListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectListResponse + fun list(params: ProjectListParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectListResponse } 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 e441602..d68b80d 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 @@ -2,96 +2,112 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +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.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions 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.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.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +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 -class ProjectServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : ProjectService { +class ProjectServiceImpl constructor(private val clientOptions: ClientOptions, ) : ProjectService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - private val inferencePipelines: InferencePipelineService by lazy { - InferencePipelineServiceImpl(clientOptions) - } + private val inferencePipelines: InferencePipelineService by lazy { InferencePipelineServiceImpl(clientOptions) } override fun commits(): CommitService = commits override fun inferencePipelines(): InferencePipelineService = inferencePipelines private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create(params: ProjectCreateParams, requestOptions: RequestOptions): ProjectCreateResponse { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + createHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: ProjectListParams, requestOptions: RequestOptions): ProjectListResponse { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 bd8b0a0..072edaa 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 @@ -4,7 +4,41 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.storage.PresignedUrlService +import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl interface StorageService { 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 25ff043..152a709 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 @@ -2,17 +2,43 @@ package com.openlayer.api.services.blocking +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl -import com.openlayer.api.services.errorHandler -class StorageServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : StorageService { +class StorageServiceImpl constructor(private val clientOptions: ClientOptions, ) : StorageService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 5ad32ef..02b5449 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 @@ -4,16 +4,45 @@ package com.openlayer.api.services.blocking.commits -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface TestResultService { /** List the test results for a project commit (project version). */ @JvmOverloads - fun list( - params: CommitTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CommitTestResultListResponse + fun list(params: CommitTestResultListParams, 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 01739b4..9b3716f 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 @@ -2,51 +2,70 @@ package com.openlayer.api.services.blocking.commits +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class TestResultServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : TestResultService { +class TestResultServiceImpl constructor(private val clientOptions: ClientOptions, ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: CommitTestResultListParams, requestOptions: RequestOptions): CommitTestResultListResponse { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 bbfd2cf..973e01e 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 @@ -4,16 +4,45 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface DataService { /** Publish an inference data point to an inference pipeline. */ @JvmOverloads - fun stream( - params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions = RequestOptions.none() - ): InferencePipelineDataStreamResponse + fun stream(params: InferencePipelineDataStreamParams, 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 41c4268..f4657c4 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 @@ -2,53 +2,71 @@ package com.openlayer.api.services.blocking.inferencePipelines +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class DataServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : DataService { +class DataServiceImpl constructor(private val clientOptions: ClientOptions, ) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { streamHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun stream(params: InferencePipelineDataStreamParams, requestOptions: RequestOptions): InferencePipelineDataStreamResponse { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + streamHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 3548f85..771f4f0 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 @@ -4,16 +4,45 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface RowService { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun update( - params: InferencePipelineRowUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): InferencePipelineRowUpdateResponse + fun update(params: InferencePipelineRowUpdateParams, 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 d5f73a0..664a7d9 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 @@ -2,53 +2,71 @@ package com.openlayer.api.services.blocking.inferencePipelines +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class RowServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : RowService { +class RowServiceImpl constructor(private val clientOptions: ClientOptions, ) : RowService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions): InferencePipelineRowUpdateResponse { + val request = HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + updateHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 24e0ca5..7688894 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 @@ -4,16 +4,45 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface TestResultService { /** List the latest test results for an inference pipeline. */ @JvmOverloads - fun list( - params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): InferencePipelineTestResultListResponse + fun list(params: InferencePipelineTestResultListParams, 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 675b14f..431decf 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 @@ -2,51 +2,70 @@ package com.openlayer.api.services.blocking.inferencePipelines +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class TestResultServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : TestResultService { +class TestResultServiceImpl constructor(private val clientOptions: ClientOptions, ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: InferencePipelineTestResultListParams, requestOptions: RequestOptions): InferencePipelineTestResultListResponse { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 c9fb11e..6f1451a 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 @@ -4,16 +4,45 @@ package com.openlayer.api.services.blocking.projects -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface CommitService { /** List the commits (project versions) in a project. */ @JvmOverloads - fun list( - params: ProjectCommitListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectCommitListResponse + fun list(params: ProjectCommitListParams, 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 6cb0342..298595e 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 @@ -2,51 +2,70 @@ package com.openlayer.api.services.blocking.projects +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class CommitServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : CommitService { +class CommitServiceImpl constructor(private val clientOptions: ClientOptions, ) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: ProjectCommitListParams, requestOptions: RequestOptions): ProjectCommitListResponse { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 93989fb..82b7049 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 @@ -4,25 +4,51 @@ package com.openlayer.api.services.blocking.projects -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException 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.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface InferencePipelineService { /** Create an inference pipeline in a project. */ @JvmOverloads - fun create( - params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectInferencePipelineCreateResponse + fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectInferencePipelineCreateResponse /** List the inference pipelines in a project. */ @JvmOverloads - fun list( - params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): ProjectInferencePipelineListResponse + fun list(params: ProjectInferencePipelineListParams, 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 cb8655e..aff9b37 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 @@ -2,84 +2,100 @@ package com.openlayer.api.services.blocking.projects +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +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.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions 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.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class InferencePipelineServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineService { +class InferencePipelineServiceImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions): ProjectInferencePipelineCreateResponse { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + createHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list(params: ProjectInferencePipelineListParams, requestOptions: RequestOptions): ProjectInferencePipelineListResponse { + val request = HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions) + .let { response -> + response.use { + listHandler.handle(it) + } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 6cc179e..f1e6882 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 @@ -4,16 +4,45 @@ package com.openlayer.api.services.blocking.storage -import com.openlayer.api.core.RequestOptions +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.core.ClientOptions +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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.services.emptyHandler +import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler +import com.openlayer.api.services.withErrorHandler interface PresignedUrlService { /** Retrieve a presigned url to post storage artifacts. */ @JvmOverloads - fun create( - params: StoragePresignedUrlCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): StoragePresignedUrlCreateResponse + fun create(params: StoragePresignedUrlCreateParams, 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 dabbfe5..428d207 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 @@ -2,53 +2,75 @@ package com.openlayer.api.services.blocking.storage +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import kotlin.LazyThreadSafetyMode.PUBLICATION +import java.time.LocalDate +import java.time.Duration +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import java.util.concurrent.CompletableFuture +import java.util.stream.Stream +import com.openlayer.api.core.Enum +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.multipartFormData +import com.openlayer.api.services.stringHandler +import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class PresignedUrlServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : PresignedUrlService { +class PresignedUrlServiceImpl constructor(private val clientOptions: ClientOptions, ) : PresignedUrlService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .apply { params.getBody().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() - } - } + override fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions): StoragePresignedUrlCreateResponse { + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { + params.getBody().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() + } + } + } } } 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 0d72bda..c0b74a2 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 @@ -43,13 +43,9 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { override fun evaluateExecutionCondition(context: ExtensionContext): ConditionEvaluationResult { return if (System.getenv(SKIP_TESTS_ENV).toBoolean()) { - ConditionEvaluationResult.disabled( - "Environment variable $SKIP_TESTS_ENV is set to true" - ) + ConditionEvaluationResult.disabled("Environment variable $SKIP_TESTS_ENV is set to true") } else { - ConditionEvaluationResult.enabled( - "Environment variable $SKIP_TESTS_ENV is not set to true" - ) + ConditionEvaluationResult.enabled("Environment variable $SKIP_TESTS_ENV is not set to true") } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt index bf5ebe7..a96c62f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt @@ -2,4 +2,8 @@ package com.openlayer.api.client +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + class OpenlayerClientTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt index fe7fc1c..cb72e6a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt @@ -1,22 +1,20 @@ package com.openlayer.api.core.http -import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat internal class HttpRequestTest { @Test fun caseInsensitiveHeadersAccessors() { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .putHeader("something_lowercase", "lowercase") - .putHeader("Something_Capitalized", "Capitalized") - .putHeader("SOMETHING_UPPERCASE", "UPPERCASE") - .build() + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .putHeader("something_lowercase", "lowercase") + .putHeader("Something_Capitalized", "Capitalized") + .putHeader("SOMETHING_UPPERCASE", "UPPERCASE") + .build() assertThat(request.headers.get("SOMETHING_LOWERCASE").getOrNull(0)).isEqualTo("lowercase") - assertThat(request.headers.get("something_capitalized").getOrNull(0)) - .isEqualTo("Capitalized") + assertThat(request.headers.get("something_capitalized").getOrNull(0)).isEqualTo("Capitalized") assertThat(request.headers.get("Something_Uppercase").getOrNull(0)).isEqualTo("UPPERCASE") } } 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 ce97799..3bd34e1 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 @@ -1,13 +1,14 @@ package com.openlayer.api.core.http -import com.github.tomakehurst.wiremock.client.WireMock.* 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 org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.assertThatThrownBy +import com.github.tomakehurst.wiremock.stubbing.Scenario +import com.github.tomakehurst.wiremock.client.WireMock.* @WireMockTest internal class RetryingHttpClientTest { @@ -16,16 +17,25 @@ internal class RetryingHttpClientTest { @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - httpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() + httpClient = OkHttpClient.builder() + .baseUrl(wmRuntimeInfo.httpBaseUrl) + .build() resetAllScenarios() } @Test fun byDefaultShouldNotAddIdempotencyHeaderToRequest() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() - stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) - val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).build() + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegment("something") + .build() + stubFor( + post(urlPathEqualTo("/something")) + .willReturn(ok()) + ) + val retryingClient = RetryingHttpClient.builder() + .httpClient(httpClient) + .build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) @@ -33,18 +43,19 @@ internal class RetryingHttpClientTest { @Test fun whenProvidedShouldAddIdempotencyHeaderToRequest() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegment("something") + .build() stubFor( post(urlPathEqualTo("/something")) .withHeader("X-Some-Header", matching("stainless-java-retry-.+")) .willReturn(ok()) ) - val retryingClient = - RetryingHttpClient.builder() - .httpClient(httpClient) - .idempotencyHeader("X-Some-Header") - .build() + val retryingClient = RetryingHttpClient.builder() + .httpClient(httpClient) + .idempotencyHeader("X-Some-Header") + .build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) @@ -52,15 +63,15 @@ internal class RetryingHttpClientTest { @Test fun retryAfterHeader() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegment("something") + .build() stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") // first we fail with a retry after header given as a date .whenScenarioStateIs(Scenario.STARTED) - .willReturn( - serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT") - ) + .willReturn(serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT")) .willSetStateTo("RETRY_AFTER_DATE") ) stubFor( @@ -77,8 +88,10 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() + val retryingClient = RetryingHttpClient.builder() + .httpClient(httpClient) + .maxRetries(2) + .build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(3, postRequestedFor(urlPathEqualTo("/something"))) @@ -86,8 +99,10 @@ internal class RetryingHttpClientTest { @Test fun retryAfterMsHeader() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + val request = HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegment("something") + .build() stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") @@ -102,8 +117,10 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(1).build() + val retryingClient = RetryingHttpClient.builder() + .httpClient(httpClient) + .maxRetries(1) + .build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(2, postRequestedFor(urlPathEqualTo("/something"))) 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 a2f9465..bed3d64 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 @@ -5,9 +5,9 @@ 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 +import java.util.* internal class SerializerTest { @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) @@ -23,7 +23,9 @@ internal class SerializerTest { fun isActive(): Boolean? = isActive.getNullable("is_active") - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + @JsonProperty("is_active") + @ExcludeMissing + fun _isActive() = isActive @JsonAnyGetter @ExcludeMissing @@ -42,30 +44,28 @@ internal class SerializerTest { } return other is ClassWithBooleanFieldPrefixedWithIs && - isActive == other.isActive && - additionalProperties == other.additionalProperties + isActive == other.isActive && + additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = - Objects.hash( - isActive, - additionalProperties, - ) + hashCode = Objects.hash( + isActive, + additionalProperties, + ) } return hashCode } - override fun toString() = - "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" + override fun toString() = "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" companion object { fun builder() = Builder() } @NoAutoDetect - class Builder { + class Builder{ private var isActive: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -73,7 +73,9 @@ internal class SerializerTest { @JsonProperty("is_active") @ExcludeMissing - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + fun isActive(isActive: JsonField) = apply { + this.isActive = isActive + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -89,14 +91,14 @@ internal class SerializerTest { this.additionalProperties.putAll(additionalProperties) } - fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs( - isActive, - additionalProperties.toUnmodifiable(), - ) + fun build(): ClassWithBooleanFieldPrefixedWithIs = ClassWithBooleanFieldPrefixedWithIs( + isActive, + additionalProperties.toUnmodifiable(), + ) } } + @Test fun serializeBooleanPrefixedWithIs() { val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() 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 a011d78..a609eae 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 @@ -2,64 +2,72 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.CommitTestResultListParams class CommitTestResultListParamsTest { @Test fun createCommitTestResultListParams() { - CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() } @Test fun getQueryParams() { - val params = - CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() - val expected = mutableMapOf>() - expected.put("includeArchived", listOf("true")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) - expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("includeArchived", listOf("true")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) + expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = - CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = - CommitTestResultListParams.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("") + val params = CommitTestResultListParams.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/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt index 05c6717..8991770 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 @@ -2,160 +2,119 @@ package com.openlayer.api.models -import com.openlayer.api.core.JsonValue +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.CommitTestResultListResponse class CommitTestResultListResponseTest { @Test fun createCommitTestResultListResponse() { - val commitTestResultListResponse = - CommitTestResultListResponse.builder() - ._meta( - CommitTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - CommitTestResultListResponse.Item.Goal.Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - CommitTestResultListResponse.Item.Goal.Threshold - .Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - ) - .build() - assertThat(commitTestResultListResponse).isNotNull - assertThat(commitTestResultListResponse._meta()) - .isEqualTo( - CommitTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(commitTestResultListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - CommitTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - CommitTestResultListResponse.Item.Goal.Threshold.Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) + val commitTestResultListResponse = CommitTestResultListResponse.builder() + ._meta(CommitTestResultListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + .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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds(listOf(CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters(listOf(JsonValue.from(mapOf()))) + .measurement("duplicateRowCount") + .operator("<=") + .value(CommitTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) + .build())) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build()) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build())) + .build() + assertThat(commitTestResultListResponse).isNotNull + assertThat(commitTestResultListResponse._meta()).isEqualTo(CommitTestResultListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + assertThat(commitTestResultListResponse.items()).containsExactly(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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds(listOf(CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters(listOf(JsonValue.from(mapOf()))) + .measurement("duplicateRowCount") + .operator("<=") + .value(CommitTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) + .build())) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build()) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) } } 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 de558c5..eb626b4 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 @@ -2,157 +2,124 @@ package com.openlayer.api.models +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID +import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamParams.InferencePipelineDataStreamBody class InferencePipelineDataStreamParamsTest { @Test fun createInferencePipelineDataStreamParams() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.config()) - .isEqualTo( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - assertThat(body.rows()) - .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()).isEqualTo(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + assertThat(body.rows()).isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) } @Test fun getBodyWithoutOptionalFields() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.config()) - .isEqualTo( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) - ) - assertThat(body.rows()) - .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + val params = InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()).isEqualTo(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build())) + assertThat(body.rows()).isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) } @Test fun getPathParam() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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("") + val params = InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt index 5d5c07f..47cd2e3 100644 --- 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 @@ -2,19 +2,25 @@ package com.openlayer.api.models -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.InferencePipelineDataStreamResponse class InferencePipelineDataStreamResponseTest { @Test fun createInferencePipelineDataStreamResponse() { - val inferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) - .build() - assertThat(inferencePipelineDataStreamResponse).isNotNull - assertThat(inferencePipelineDataStreamResponse.success()) - .isEqualTo(InferencePipelineDataStreamResponse.Success.TRUE) + 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/InferencePipelineRowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt index f4a70bf..2d4d4e4 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 @@ -2,123 +2,120 @@ package com.openlayer.api.models +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID +import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateParams.InferencePipelineRowUpdateBody class InferencePipelineRowUpdateParamsTest { @Test fun createInferencePipelineRowUpdateParams() { - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config( - InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build() - ) - .inferenceId("inferenceId") - .build() + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config(InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build()) + .inferenceId("inferenceId") + .build() } @Test fun getQueryParams() { - val params = - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config( - InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build() - ) - .inferenceId("inferenceId") - .build() - val expected = mutableMapOf>() - expected.put("inferenceId", listOf("inferenceId")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config(InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build()) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .build() - val expected = mutableMapOf>() - expected.put("inferenceId", listOf("inferenceId")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getBody() { - val params = - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config( - InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build() - ) - .inferenceId("inferenceId") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) - assertThat(body.config()) - .isEqualTo( - InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build() - ) + val params = InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config(InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build()) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body.config()).isEqualTo(InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build()) } @Test fun getBodyWithoutOptionalFields() { - val params = - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + val params = InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) } @Test fun getPathParam() { - val params = - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .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("") + val params = InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .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/InferencePipelineRowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt index 427675b..e6f8d09 100644 --- 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 @@ -2,19 +2,25 @@ package com.openlayer.api.models -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.InferencePipelineRowUpdateResponse class InferencePipelineRowUpdateResponseTest { @Test fun createInferencePipelineRowUpdateResponse() { - val inferencePipelineRowUpdateResponse = - InferencePipelineRowUpdateResponse.builder() - .success(InferencePipelineRowUpdateResponse.Success.TRUE) - .build() - assertThat(inferencePipelineRowUpdateResponse).isNotNull - assertThat(inferencePipelineRowUpdateResponse.success()) - .isEqualTo(InferencePipelineRowUpdateResponse.Success.TRUE) + 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/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt index 6de2ac0..06208f7 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 @@ -2,67 +2,69 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.InferencePipelineTestResultListParams class InferencePipelineTestResultListParamsTest { @Test fun createInferencePipelineTestResultListParams() { - InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() } @Test fun getQueryParams() { - val params = - InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() - val expected = mutableMapOf>() - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put( - "status", - listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString()) - ) - expected.put( - "type", - listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) - ) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("status", listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString())) + expected.put("type", listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = - InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = - InferencePipelineTestResultListParams.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("") + val params = InferencePipelineTestResultListParams.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/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt index d9eadbb..bd2060f 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 @@ -2,166 +2,119 @@ package com.openlayer.api.models -import com.openlayer.api.core.JsonValue +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.InferencePipelineTestResultListResponse class InferencePipelineTestResultListResponseTest { @Test fun createInferencePipelineTestResultListResponse() { - val inferencePipelineTestResultListResponse = - InferencePipelineTestResultListResponse.builder() - ._meta( - InferencePipelineTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - InferencePipelineTestResultListResponse.Item.Goal - .Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - InferencePipelineTestResultListResponse.Item - .Goal - .Threshold - .Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - ) - .build() - assertThat(inferencePipelineTestResultListResponse).isNotNull - assertThat(inferencePipelineTestResultListResponse._meta()) - .isEqualTo( - InferencePipelineTestResultListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(inferencePipelineTestResultListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds( - listOf( - InferencePipelineTestResultListResponse.Item.Goal.Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - InferencePipelineTestResultListResponse.Item.Goal - .Threshold - .Value - .ofDouble(42.23) - ) - .build() - ) - ) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) + val inferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse.builder() + ._meta(InferencePipelineTestResultListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + .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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds(listOf(InferencePipelineTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters(listOf(JsonValue.from(mapOf()))) + .measurement("duplicateRowCount") + .operator("<=") + .value(InferencePipelineTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) + .build())) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build()) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build())) + .build() + assertThat(inferencePipelineTestResultListResponse).isNotNull + assertThat(inferencePipelineTestResultListResponse._meta()).isEqualTo(InferencePipelineTestResultListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + assertThat(inferencePipelineTestResultListResponse.items()).containsExactly(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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds(listOf(InferencePipelineTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters(listOf(JsonValue.from(mapOf()))) + .measurement("duplicateRowCount") + .operator("<=") + .value(InferencePipelineTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) + .build())) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build()) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) } } 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 17d2e0a..d843e16 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 @@ -2,55 +2,63 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.ProjectCommitListParams class ProjectCommitListParamsTest { @Test fun createProjectCommitListParams() { - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() } @Test fun getQueryParams() { - val params = - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = - ProjectCommitListParams.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("") + val params = ProjectCommitListParams.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/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt index 5793bd5..706ad5b 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 @@ -2,123 +2,103 @@ package com.openlayer.api.models +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.ProjectCommitListResponse class ProjectCommitListResponseTest { @Test fun createProjectCommitListResponse() { - val projectCommitListResponse = - ProjectCommitListResponse.builder() - ._meta( - ProjectCommitListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links( - ProjectCommitListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .build() - ) - ) - .build() - assertThat(projectCommitListResponse).isNotNull - assertThat(projectCommitListResponse._meta()) - .isEqualTo( - ProjectCommitListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(projectCommitListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links( - ProjectCommitListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .build() - ) + val projectCommitListResponse = ProjectCommitListResponse.builder() + ._meta(ProjectCommitListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + .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(123L) + .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(123L) + .gitCommitUrl("gitCommitUrl") + .build()) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(123L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(true) + .deploymentStatus("Deployed") + .links(ProjectCommitListResponse.Item.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + .build())) + .build() + assertThat(projectCommitListResponse).isNotNull + assertThat(projectCommitListResponse._meta()).isEqualTo(ProjectCommitListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + assertThat(projectCommitListResponse.items()).containsExactly(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(123L) + .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(123L) + .gitCommitUrl("gitCommitUrl") + .build()) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(123L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(true) + .deploymentStatus("Deployed") + .links(ProjectCommitListResponse.Item.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + .build()) } } 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 0a0a757..859a38c 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,46 +2,56 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.ProjectCreateParams +import com.openlayer.api.models.ProjectCreateParams.ProjectCreateBody class ProjectCreateParamsTest { @Test fun createProjectCreateParams() { - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() } @Test fun getBody() { - val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("My Project") - assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) - assertThat(body.description()).isEqualTo("My project description.") + val params = ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + assertThat(body.description()).isEqualTo("My project description.") } @Test fun getBodyWithoutOptionalFields() { - val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("My Project") - assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + val params = ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) } } 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/ProjectCreateResponseTest.kt index 1fc43bb..cebddea 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/ProjectCreateResponseTest.kt @@ -2,98 +2,85 @@ package com.openlayer.api.models +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.ProjectCreateResponse class ProjectCreateResponseTest { @Test fun createProjectCreateResponse() { - 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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectCreateResponse.Source.WEB) - .taskType(ProjectCreateResponse.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) - .build() - assertThat(projectCreateResponse).isNotNull - assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCreateResponse.creatorId()) - .contains("589ece63-49a2-41b4-98e1-10547761d4b0") - assertThat(projectCreateResponse.dateCreated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCreateResponse.dateUpdated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) - assertThat(projectCreateResponse.links()) - .isEqualTo( - ProjectCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.name()).isEqualTo("My Project") - assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) - assertThat(projectCreateResponse.taskType()) - .isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) - assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) - assertThat(projectCreateResponse.workspaceId()) - .contains("055fddb1-261f-4654-8598-f6347ee46a09") - assertThat(projectCreateResponse.description()).contains("My project description.") - assertThat(projectCreateResponse.gitRepo()) - .contains( - 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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) + 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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links(ProjectCreateResponse.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectCreateResponse.Source.WEB) + .taskType(ProjectCreateResponse.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build()) + .build() + assertThat(projectCreateResponse).isNotNull + assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectCreateResponse.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(projectCreateResponse.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) + assertThat(projectCreateResponse.links()).isEqualTo(ProjectCreateResponse.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.name()).isEqualTo("My Project") + assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) + assertThat(projectCreateResponse.taskType()).isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) + assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) + assertThat(projectCreateResponse.workspaceId()).contains("055fddb1-261f-4654-8598-f6347ee46a09") + assertThat(projectCreateResponse.description()).contains("My project description.") + assertThat(projectCreateResponse.gitRepo()).contains(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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build()) } } 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 0e96084..f64c627 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,58 +2,67 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateParams.ProjectInferencePipelineCreateBody class ProjectInferencePipelineCreateParamsTest { @Test fun createProjectInferencePipelineCreateParams() { - ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .build() + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() } @Test fun getBody() { - 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()).isEqualTo("This pipeline is used for production.") - assertThat(body.name()).isEqualTo("production") + 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()).isEqualTo("This pipeline is used for production.") + assertThat(body.name()).isEqualTo("production") } @Test fun getBodyWithoutOptionalFields() { - val params = - ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("production") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("production") + val params = ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("production") } @Test fun getPathParam() { - val params = - ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("production") - .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("") + val params = ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .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/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt index 2398c71..064535b 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 @@ -2,70 +2,57 @@ package com.openlayer.api.models +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse class ProjectInferencePipelineCreateResponseTest { @Test fun createProjectInferencePipelineCreateResponse() { - val projectInferencePipelineCreateResponse = - ProjectInferencePipelineCreateResponse.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(123L) - .links( - ProjectInferencePipelineCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .name("production") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .build() - assertThat(projectInferencePipelineCreateResponse).isNotNull - assertThat(projectInferencePipelineCreateResponse.id()) - .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.dateCreated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateUpdated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.description()) - .contains("This pipeline is used for production.") - assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) - assertThat(projectInferencePipelineCreateResponse.links()) - .isEqualTo( - ProjectInferencePipelineCreateResponse.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(123L) - assertThat(projectInferencePipelineCreateResponse.projectId()) - .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.status()) - .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) - assertThat(projectInferencePipelineCreateResponse.statusMessage()) - .contains("Tests successfully evaluated") - assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) + val projectInferencePipelineCreateResponse = ProjectInferencePipelineCreateResponse.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(123L) + .links(ProjectInferencePipelineCreateResponse.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + assertThat(projectInferencePipelineCreateResponse).isNotNull + assertThat(projectInferencePipelineCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.description()).contains("This pipeline is used for production.") + assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.links()).isEqualTo(ProjectInferencePipelineCreateResponse.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(123L) + assertThat(projectInferencePipelineCreateResponse.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.status()).isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) + assertThat(projectInferencePipelineCreateResponse.statusMessage()).contains("Tests successfully evaluated") + assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) } } 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 671b802..99c2565 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 @@ -2,58 +2,66 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.ProjectInferencePipelineListParams class ProjectInferencePipelineListParamsTest { @Test fun createProjectInferencePipelineListParams() { - ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build() + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() } @Test fun getQueryParams() { - val params = - ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("name")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("name")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = - ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = - ProjectInferencePipelineListParams.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("") + val params = ProjectInferencePipelineListParams.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/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt index 37bb0ca..f27c2c3 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 @@ -2,91 +2,73 @@ package com.openlayer.api.models +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.ProjectInferencePipelineListResponse class ProjectInferencePipelineListResponseTest { @Test fun createProjectInferencePipelineListResponse() { - val projectInferencePipelineListResponse = - ProjectInferencePipelineListResponse.builder() - ._meta( - ProjectInferencePipelineListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .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(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .build() - ) - ) - .build() - assertThat(projectInferencePipelineListResponse).isNotNull - assertThat(projectInferencePipelineListResponse._meta()) - .isEqualTo( - ProjectInferencePipelineListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(projectInferencePipelineListResponse.items()) - .containsExactly( - 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(123L) - .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(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .build() - ) + val projectInferencePipelineListResponse = ProjectInferencePipelineListResponse.builder() + ._meta(ProjectInferencePipelineListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + .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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build())) + .build() + assertThat(projectInferencePipelineListResponse).isNotNull + assertThat(projectInferencePipelineListResponse._meta()).isEqualTo(ProjectInferencePipelineListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + assertThat(projectInferencePipelineListResponse.items()).containsExactly(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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build()) } } 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 daf73e7..7b8d3a1 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 @@ -2,43 +2,53 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.ProjectListParams class ProjectListParamsTest { @Test fun createProjectListParams() { - ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() } @Test fun getQueryParams() { - val params = - ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("name")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("name")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = ProjectListParams.builder().build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectListParams.builder().build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } } 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 c30dee9..7e0cf3d 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 @@ -2,121 +2,101 @@ package com.openlayer.api.models +import java.time.LocalDate import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.ProjectListResponse class ProjectListResponseTest { @Test fun createProjectListResponse() { - val projectListResponse = - ProjectListResponse.builder() - ._meta( - ProjectListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - .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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) - .build() - ) - ) - .build() - assertThat(projectListResponse).isNotNull - assertThat(projectListResponse._meta()) - .isEqualTo( - ProjectListResponse._Meta - .builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build() - ) - assertThat(projectListResponse.items()) - .containsExactly( - 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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) - .build() - ) + val projectListResponse = ProjectListResponse.builder() + ._meta(ProjectListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + .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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links(ProjectListResponse.Item.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build()) + .build())) + .build() + assertThat(projectListResponse).isNotNull + assertThat(projectListResponse._meta()).isEqualTo(ProjectListResponse._Meta.builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build()) + assertThat(projectListResponse.items()).containsExactly(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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links(ProjectListResponse.Item.Links.builder() + .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build()) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build()) + .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 6ae03e8..ff29905 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 @@ -2,30 +2,47 @@ package com.openlayer.api.models -import com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import org.apache.hc.core5.http.ContentType +import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.MultipartFormValue +import com.openlayer.api.models.* +import com.openlayer.api.models.StoragePresignedUrlCreateParams class StoragePresignedUrlCreateParamsTest { @Test fun createStoragePresignedUrlCreateParams() { - StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + StoragePresignedUrlCreateParams.builder() + .objectName("objectName") + .build() } @Test fun getQueryParams() { - val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() - val expected = mutableMapOf>() - expected.put("objectName", listOf("objectName")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = StoragePresignedUrlCreateParams.builder() + .objectName("objectName") + .build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() - val expected = mutableMapOf>() - expected.put("objectName", listOf("objectName")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = StoragePresignedUrlCreateParams.builder() + .objectName("objectName") + .build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) } } 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 index c6dd2f5..9e63230 100644 --- 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 @@ -2,24 +2,29 @@ package com.openlayer.api.models -import com.openlayer.api.core.JsonValue -import org.assertj.core.api.Assertions.assertThat +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.UUID import org.junit.jupiter.api.Test +import org.assertj.core.api.Assertions.assertThat +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.StoragePresignedUrlCreateResponse 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())) + 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/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index 4dfd4b0..c5b8310 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,19 +2,37 @@ 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.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest +import com.github.tomakehurst.wiremock.client.WireMock.binaryEqualTo +import com.github.tomakehurst.wiremock.client.WireMock.equalTo import com.github.tomakehurst.wiremock.client.WireMock.get import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.post +import com.github.tomakehurst.wiremock.client.WireMock.put +import com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor +import com.github.tomakehurst.wiremock.client.WireMock.delete import com.github.tomakehurst.wiremock.client.WireMock.status import com.github.tomakehurst.wiremock.client.WireMock.stubFor -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest -import com.google.common.collect.ImmutableListMultimap +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.assertThatThrownBy +import org.assertj.guava.api.Assertions.assertThat import com.google.common.collect.ListMultimap +import com.google.common.collect.ImmutableListMultimap +import com.fasterxml.jackson.databind.json.JsonMapper +import java.io.IOException +import java.time.LocalDate +import java.time.OffsetDateTime +import java.util.UUID +import org.assertj.core.api.InstanceOfAssertFactories +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import java.io.InputStream +import java.io.ByteArrayOutputStream import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper @@ -23,657 +41,439 @@ 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.OpenlayerServiceException 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 com.openlayer.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import org.assertj.core.api.InstanceOfAssertFactories -import org.assertj.guava.api.Assertions.assertThat -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test @WireMockTest class ErrorHandlingTest { private val JSON_MAPPER: JsonMapper = jsonMapper() - private val OPENLAYER_ERROR: OpenlayerError = - OpenlayerError.builder().putAdditionalProperty("key", JsonString.of("value")).build() + private val OPENLAYER_ERROR: OpenlayerError = OpenlayerError.builder().putAdditionalProperty("key", JsonString.of("value")).build() private lateinit var client: OpenlayerClient @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = - OpenlayerOkHttpClient.builder() - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) - .apiKey("My API Key") - .build() + client = OpenlayerOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) + .apiKey("My API Key") + .build() } @Test fun dataStream200() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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) } @Test fun dataStream400() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun dataStream401() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun dataStream403() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun dataStream404() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun dataStream422() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertUnprocessableEntity( - e, - ImmutableListMultimap.of("Foo", "Bar"), - OPENLAYER_ERROR - ) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> assertUnprocessableEntity(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun dataStream429() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun dataStream500() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test fun unexpectedStatusCode() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor( - post(anyUrl()) - .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertUnexpectedStatusCodeException( - e, - 999, - ImmutableListMultimap.of("Foo", "Bar"), - toJson(OPENLAYER_ERROR) - ) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertUnexpectedStatusCodeException(e, 999, ImmutableListMultimap.of("Foo", "Bar"), toJson(OPENLAYER_ERROR)) }) } @Test fun invalidBody() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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") - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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") }) } @Test fun invalidErrorBody() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) - }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()) + .willReturn(status(400).withBody("Not JSON"))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) }) } private fun toJson(body: T): ByteArray { - return JSON_MAPPER.writeValueAsBytes(body) + return JSON_MAPPER.writeValueAsBytes(body) } - private fun assertUnexpectedStatusCodeException( - throwable: Throwable, - statusCode: Int, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertUnexpectedStatusCodeException(throwable: Throwable, statusCode: Int, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertBadRequest( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertBadRequest(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertUnauthorized( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertUnauthorized(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertPermissionDenied( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertPermissionDenied(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertNotFound( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertNotFound(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertUnprocessableEntity( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertUnprocessableEntity(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertRateLimit( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertRateLimit(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } - private fun assertInternalServer( - throwable: Throwable, - headers: ListMultimap, - 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()).containsAllEntriesOf(headers) - }) + private fun assertInternalServer(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) } } 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 4378175..9bf6fd7 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 @@ -3,26 +3,41 @@ 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.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.github.tomakehurst.wiremock.client.WireMock.equalTo -import com.github.tomakehurst.wiremock.client.WireMock.get -import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath import com.github.tomakehurst.wiremock.client.WireMock.ok +import com.github.tomakehurst.wiremock.client.WireMock.get import com.github.tomakehurst.wiremock.client.WireMock.post -import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor import com.github.tomakehurst.wiremock.client.WireMock.put +import com.github.tomakehurst.wiremock.client.WireMock.delete +import com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor import com.github.tomakehurst.wiremock.client.WireMock.stubFor +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl +import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath import com.github.tomakehurst.wiremock.client.WireMock.verify -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest +import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor +import com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor +import java.io.IOException +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.jsonMapper +import com.openlayer.api.core.JsonNull import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.jsonMapper +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.errors.OpenlayerServiceException +import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.models.* -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test @WireMockTest class ServiceParamsTest { @@ -33,77 +48,63 @@ class ServiceParamsTest { @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = - OpenlayerOkHttpClient.builder() - .apiKey("My API Key") - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) - .build() + client = OpenlayerOkHttpClient.builder() + .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", JsonString.of("ghi890")) - - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .additionalHeaders(additionalHeaders) - .additionalBodyProperties(additionalBodyProperties) - .additionalQueryParams(additionalQueryParams) - .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())) + 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", JsonString.of("ghi890")) + + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .additionalHeaders(additionalHeaders) + .additionalBodyProperties(additionalBodyProperties) + .additionalQueryParams(additionalQueryParams) + .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())) } } 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 4a62862..123ebae 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 @@ -2,8 +2,26 @@ package com.openlayer.api.services.blocking +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.CommitService import com.openlayer.api.models.* -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class CommitServiceTest +@ExtendWith(TestServerExtension::class) +class CommitServiceTest 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 af33b2f..74b59ea 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 @@ -2,8 +2,26 @@ package com.openlayer.api.services.blocking +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.InferencePipelineService import com.openlayer.api.models.* -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceTest 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 a87bdef..d00b28d 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 @@ -2,53 +2,60 @@ package com.openlayer.api.services.blocking +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.ProjectService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class ProjectServiceTest { @Test fun callCreate() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectCreateResponse = - projectService.create( - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() - ) - println(projectCreateResponse) - projectCreateResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectCreateResponse = projectService.create(ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build()) + println(projectCreateResponse) + projectCreateResponse.validate() } @Test fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectListResponse = - projectService.list( - ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() - ) - println(projectListResponse) - projectListResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectListResponse = projectService.list(ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build()) + println(projectListResponse) + projectListResponse.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt index 5c66b4e..354c84e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt @@ -2,8 +2,26 @@ package com.openlayer.api.services.blocking +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.StorageService import com.openlayer.api.models.* -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class StorageServiceTest +@ExtendWith(TestServerExtension::class) +class StorageServiceTest 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 1f87370..1810f70 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 @@ -2,35 +2,46 @@ package com.openlayer.api.services.blocking.commits +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class TestResultServiceTest { @Test fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val testResultService = client.commits().testResults() - val commitTestResultListResponse = - testResultService.list( - CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() - ) - println(commitTestResultListResponse) - commitTestResultListResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.commits().testResults() + val commitTestResultListResponse = testResultService.list(CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build()) + println(commitTestResultListResponse) + commitTestResultListResponse.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 0b70b54..6505192 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 @@ -2,58 +2,59 @@ package com.openlayer.api.services.blocking.inferencePipelines +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.inferencePipelines.DataService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class DataServiceTest { @Test fun callStream() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val dataService = client.inferencePipelines().data() - val inferencePipelineDataStreamResponse = - dataService.stream( - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - ) - println(inferencePipelineDataStreamResponse) - inferencePipelineDataStreamResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dataService = client.inferencePipelines().data() + val inferencePipelineDataStreamResponse = dataService.stream(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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build())) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build())) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build()) + println(inferencePipelineDataStreamResponse) + inferencePipelineDataStreamResponse.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 8347fd9..1e1a086 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 @@ -2,42 +2,50 @@ package com.openlayer.api.services.blocking.inferencePipelines +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.inferencePipelines.RowService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class RowServiceTest { @Test fun callUpdate() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val rowService = client.inferencePipelines().rows() - val inferencePipelineRowUpdateResponse = - rowService.update( - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config( - InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build() - ) - .inferenceId("inferenceId") - .build() - ) - println(inferencePipelineRowUpdateResponse) - inferencePipelineRowUpdateResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val rowService = client.inferencePipelines().rows() + val inferencePipelineRowUpdateResponse = rowService.update(InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config(InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build()) + .inferenceId("inferenceId") + .build()) + println(inferencePipelineRowUpdateResponse) + inferencePipelineRowUpdateResponse.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 67a11f1..046ecaa 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 @@ -2,34 +2,45 @@ package com.openlayer.api.services.blocking.inferencePipelines +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.inferencePipelines.TestResultService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class TestResultServiceTest { @Test fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val testResultService = client.inferencePipelines().testResults() - val inferencePipelineTestResultListResponse = - testResultService.list( - InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() - ) - println(inferencePipelineTestResultListResponse) - inferencePipelineTestResultListResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.inferencePipelines().testResults() + val inferencePipelineTestResultListResponse = testResultService.list(InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build()) + println(inferencePipelineTestResultListResponse) + inferencePipelineTestResultListResponse.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 83a9c12..60412bc 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 @@ -2,32 +2,43 @@ package com.openlayer.api.services.blocking.projects +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class CommitServiceTest { @Test fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val commitService = client.projects().commits() - val projectCommitListResponse = - commitService.list( - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() - ) - println(projectCommitListResponse) - projectCommitListResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitService = client.projects().commits() + val projectCommitListResponse = commitService.list(ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build()) + println(projectCommitListResponse) + projectCommitListResponse.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 ed1ee7c..d4c9e89 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 @@ -2,53 +2,60 @@ package com.openlayer.api.services.blocking.projects +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest { @Test fun callCreate() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineCreateResponse = - inferencePipelineService.create( - ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .build() - ) - println(projectInferencePipelineCreateResponse) - projectInferencePipelineCreateResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineCreateResponse = inferencePipelineService.create(ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build()) + println(projectInferencePipelineCreateResponse) + projectInferencePipelineCreateResponse.validate() } @Test fun callList() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineListResponse = - inferencePipelineService.list( - ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build() - ) - println(projectInferencePipelineListResponse) - projectInferencePipelineListResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineListResponse = inferencePipelineService.list(ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build()) + println(projectInferencePipelineListResponse) + projectInferencePipelineListResponse.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 558cb7c..db0e2e3 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 @@ -2,28 +2,41 @@ package com.openlayer.api.services.blocking.storage +import java.time.LocalDate +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Base64 +import java.util.Optional +import java.util.UUID +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonNull +import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.http.BinaryResponseContent +import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.models.* -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class PresignedUrlServiceTest { @Test fun callCreate() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val presignedUrlService = client.storage().presignedUrl() - val storagePresignedUrlCreateResponse = - presignedUrlService.create( - StoragePresignedUrlCreateParams.builder().objectName("objectName").build() - ) - println(storagePresignedUrlCreateResponse) - storagePresignedUrlCreateResponse.validate() + val client = OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlService = client.storage().presignedUrl() + val storagePresignedUrlCreateResponse = presignedUrlService.create(StoragePresignedUrlCreateParams.builder() + .objectName("objectName") + .build()) + println(storagePresignedUrlCreateResponse) + storagePresignedUrlCreateResponse.validate() } } From 57cd9b93d5cc5a955a2ca30136e53fcbc0db3fe1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:20:58 +0000 Subject: [PATCH 15/21] feat(api): OpenAPI spec update via Stainless API (#22) --- .../api/client/okhttp/OkHttpClient.kt | 19 +- .../client/okhttp/OpenlayerOkHttpClient.kt | 69 +- .../okhttp/OpenlayerOkHttpClientAsync.kt | 69 +- .../openlayer/api/client/OpenlayerClient.kt | 19 - .../api/client/OpenlayerClientAsync.kt | 19 - .../api/client/OpenlayerClientAsyncImpl.kt | 24 +- .../api/client/OpenlayerClientImpl.kt | 24 +- .../openlayer/api/core/BaseDeserializer.kt | 20 +- .../com/openlayer/api/core/ClientOptions.kt | 132 +- .../com/openlayer/api/core/Properties.kt | 11 +- .../com/openlayer/api/core/RequestOptions.kt | 4 +- .../kotlin/com/openlayer/api/core/Utils.kt | 8 +- .../kotlin/com/openlayer/api/core/Values.kt | 141 +- .../api/core/http/BinaryResponseContent.kt | 3 +- .../com/openlayer/api/core/http/HttpClient.kt | 2 +- .../openlayer/api/core/http/HttpRequest.kt | 1 - .../api/core/http/HttpRequestBody.kt | 7 +- .../api/core/http/RetryingHttpClient.kt | 165 +- .../api/errors/BadRequestException.kt | 5 +- .../api/errors/InternalServerException.kt | 7 +- .../openlayer/api/errors/NotFoundException.kt | 5 +- .../openlayer/api/errors/OpenlayerError.kt | 33 +- .../api/errors/OpenlayerServiceException.kt | 7 +- .../api/errors/PermissionDeniedException.kt | 5 +- .../api/errors/RateLimitException.kt | 5 +- .../api/errors/UnauthorizedException.kt | 5 +- .../errors/UnexpectedStatusCodeException.kt | 8 +- .../errors/UnprocessableEntityException.kt | 5 +- .../api/models/CommitTestResultListParams.kt | 312 ++- .../models/CommitTestResultListResponse.kt | 1262 ++++++------ .../InferencePipelineDataStreamParams.kt | 1712 +++++++++-------- .../InferencePipelineDataStreamResponse.kt | 113 +- .../InferencePipelineRowUpdateParams.kt | 385 ++-- .../InferencePipelineRowUpdateResponse.kt | 118 +- .../InferencePipelineTestResultListParams.kt | 306 ++- ...InferencePipelineTestResultListResponse.kt | 1266 ++++++------ .../api/models/ProjectCommitListParams.kt | 162 +- .../api/models/ProjectCommitListResponse.kt | 949 +++++---- .../api/models/ProjectCreateParams.kt | 625 +++--- .../api/models/ProjectCreateResponse.kt | 734 ++++--- .../ProjectInferencePipelineCreateParams.kt | 337 ++-- .../ProjectInferencePipelineCreateResponse.kt | 434 ++--- .../ProjectInferencePipelineListParams.kt | 201 +- .../ProjectInferencePipelineListResponse.kt | 625 +++--- .../openlayer/api/models/ProjectListParams.kt | 220 +-- .../api/models/ProjectListResponse.kt | 939 ++++----- .../models/StoragePresignedUrlCreateParams.kt | 141 +- .../StoragePresignedUrlCreateResponse.kt | 136 +- .../com/openlayer/api/services/Handlers.kt | 48 +- .../api/services/HttpRequestBodies.kt | 35 +- .../api/services/async/CommitServiceAsync.kt | 34 - .../services/async/CommitServiceAsyncImpl.kt | 40 +- .../async/InferencePipelineServiceAsync.kt | 36 - .../InferencePipelineServiceAsyncImpl.kt | 40 +- .../api/services/async/ProjectServiceAsync.kt | 47 +- .../services/async/ProjectServiceAsyncImpl.kt | 145 +- .../api/services/async/StorageServiceAsync.kt | 34 - .../services/async/StorageServiceAsyncImpl.kt | 40 +- .../async/commits/TestResultServiceAsync.kt | 40 +- .../commits/TestResultServiceAsyncImpl.kt | 83 +- .../inferencePipelines/DataServiceAsync.kt | 40 +- .../DataServiceAsyncImpl.kt | 84 +- .../inferencePipelines/RowServiceAsync.kt | 40 +- .../inferencePipelines/RowServiceAsyncImpl.kt | 84 +- .../TestResultServiceAsync.kt | 40 +- .../TestResultServiceAsyncImpl.kt | 83 +- .../async/projects/CommitServiceAsync.kt | 40 +- .../async/projects/CommitServiceAsyncImpl.kt | 83 +- .../projects/InferencePipelineServiceAsync.kt | 45 +- .../InferencePipelineServiceAsyncImpl.kt | 135 +- .../async/storage/PresignedUrlServiceAsync.kt | 40 +- .../storage/PresignedUrlServiceAsyncImpl.kt | 86 +- .../api/services/blocking/CommitService.kt | 34 - .../services/blocking/CommitServiceImpl.kt | 36 +- .../blocking/InferencePipelineService.kt | 36 - .../blocking/InferencePipelineServiceImpl.kt | 36 +- .../api/services/blocking/ProjectService.kt | 46 +- .../services/blocking/ProjectServiceImpl.kt | 142 +- .../api/services/blocking/StorageService.kt | 34 - .../services/blocking/StorageServiceImpl.kt | 36 +- .../blocking/commits/TestResultService.kt | 39 +- .../blocking/commits/TestResultServiceImpl.kt | 81 +- .../inferencePipelines/DataService.kt | 39 +- .../inferencePipelines/DataServiceImpl.kt | 82 +- .../blocking/inferencePipelines/RowService.kt | 39 +- .../inferencePipelines/RowServiceImpl.kt | 82 +- .../inferencePipelines/TestResultService.kt | 39 +- .../TestResultServiceImpl.kt | 81 +- .../blocking/projects/CommitService.kt | 39 +- .../blocking/projects/CommitServiceImpl.kt | 81 +- .../projects/InferencePipelineService.kt | 44 +- .../projects/InferencePipelineServiceImpl.kt | 132 +- .../blocking/storage/PresignedUrlService.kt | 39 +- .../storage/PresignedUrlServiceImpl.kt | 84 +- .../com/openlayer/api/TestServerExtension.kt | 8 +- .../api/client/OpenlayerClientTest.kt | 4 - .../api/core/http/HttpRequestTest.kt | 18 +- .../api/core/http/RetryingHttpClientTest.kt | 69 +- .../openlayer/api/core/http/SerializerTest.kt | 38 +- .../models/CommitTestResultListParamsTest.kt | 90 +- .../CommitTestResultListResponseTest.kt | 255 +-- .../InferencePipelineDataStreamParamsTest.kt | 233 ++- ...InferencePipelineDataStreamResponseTest.kt | 22 +- .../InferencePipelineRowUpdateParamsTest.kt | 179 +- .../InferencePipelineRowUpdateResponseTest.kt | 22 +- ...ferencePipelineTestResultListParamsTest.kt | 90 +- ...rencePipelineTestResultListResponseTest.kt | 261 +-- .../api/models/ProjectCommitListParamsTest.kt | 72 +- .../models/ProjectCommitListResponseTest.kt | 202 +- .../api/models/ProjectCreateParamsTest.kt | 64 +- .../api/models/ProjectCreateResponseTest.kt | 159 +- ...rojectInferencePipelineCreateParamsTest.kt | 79 +- ...jectInferencePipelineCreateResponseTest.kt | 103 +- .../ProjectInferencePipelineListParamsTest.kt | 78 +- ...rojectInferencePipelineListResponseTest.kt | 140 +- .../api/models/ProjectListParamsTest.kt | 58 +- .../api/models/ProjectListResponseTest.kt | 198 +- .../StoragePresignedUrlCreateParamsTest.kt | 39 +- .../StoragePresignedUrlCreateResponseTest.kt | 31 +- .../api/services/ErrorHandlingTest.kt | 954 +++++---- .../api/services/ServiceParamsTest.kt | 155 +- .../services/blocking/CommitServiceTest.kt | 22 +- .../blocking/InferencePipelineServiceTest.kt | 22 +- .../services/blocking/ProjectServiceTest.kt | 77 +- .../services/blocking/StorageServiceTest.kt | 22 +- .../blocking/commits/TestResultServiceTest.kt | 53 +- .../inferencePipelines/DataServiceTest.kt | 87 +- .../inferencePipelines/RowServiceTest.kt | 62 +- .../TestResultServiceTest.kt | 51 +- .../blocking/projects/CommitServiceTest.kt | 47 +- .../projects/InferencePipelineServiceTest.kt | 77 +- .../storage/PresignedUrlServiceTest.kt | 41 +- 132 files changed, 8459 insertions(+), 10245 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 841664d..13779b0 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 @@ -4,28 +4,27 @@ import com.google.common.collect.ListMultimap import com.google.common.collect.MultimapBuilder import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpRequestBody import com.openlayer.api.core.http.HttpResponse -import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.io.InputStream import java.net.Proxy import java.time.Duration import java.util.concurrent.CompletableFuture -import java.util.concurrent.TimeUnit import okhttp3.Call import okhttp3.Callback -import okhttp3.HttpUrl -import okhttp3.Response -import okhttp3.Request -import okhttp3.RequestBody -import okhttp3.MediaType import okhttp3.Headers +import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaType +import okhttp3.Request +import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.Response import okio.BufferedSink class OkHttpClient @@ -34,7 +33,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient { val timeout = requestOptions.timeout ?: return okHttpClient - return okHttpClient.newBuilder() + return okHttpClient + .newBuilder() .connectTimeout(timeout) .readTimeout(timeout) .writeTimeout(timeout) @@ -76,7 +76,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val override fun onFailure(call: Call, e: IOException) { future.completeExceptionally(OpenlayerIoException("Request failed", e)) } - }) + } + ) return future } 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 59c6cec..1dff803 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 @@ -3,25 +3,20 @@ package com.openlayer.api.client.okhttp import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.Multimap +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.OpenlayerClientImpl +import com.openlayer.api.core.ClientOptions import java.net.Proxy import java.time.Clock import java.time.Duration -import java.util.Optional -import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpClient -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.OpenlayerClientImpl class OpenlayerOkHttpClient private constructor() { companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() - @JvmStatic - fun fromEnv(): OpenlayerClient = builder().fromEnv().build() + @JvmStatic fun fromEnv(): OpenlayerClient = builder().fromEnv().build() } class Builder { @@ -37,21 +32,15 @@ class OpenlayerOkHttpClient private constructor() { this.baseUrl = baseUrl } - fun jsonMapper(jsonMapper: JsonMapper) = apply { - clientOptions.jsonMapper(jsonMapper) - } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } - fun clock(clock: Clock) = apply { - clientOptions.clock(clock) - } + fun clock(clock: Clock) = apply { clientOptions.clock(clock) } fun headers(headers: Map>) = apply { clientOptions.headers(headers) } - fun putHeader(name: String, value: String) = apply { - clientOptions.putHeader(name, value) - } + fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) } fun putHeaders(name: String, values: Iterable) = apply { clientOptions.putHeaders(name, values) @@ -61,42 +50,34 @@ class OpenlayerOkHttpClient private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { - clientOptions.removeHeader(name) - } + fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } - fun timeout(timeout: Duration) = apply { - this.timeout = timeout - } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } - fun maxRetries(maxRetries: Int) = apply { - clientOptions.maxRetries(maxRetries) - } + fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } - fun proxy(proxy: Proxy) = apply { - this.proxy = proxy - } + fun proxy(proxy: Proxy) = apply { this.proxy = proxy } fun responseValidation(responseValidation: Boolean) = apply { clientOptions.responseValidation(responseValidation) } - fun apiKey(apiKey: String?) = apply { - clientOptions.apiKey(apiKey) - } + fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } - fun fromEnv() = apply { - clientOptions.fromEnv() - } + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): OpenlayerClient { - return OpenlayerClientImpl(clientOptions - .httpClient(OkHttpClient.builder() - .baseUrl(baseUrl) - .timeout(timeout) - .proxy(proxy) - .build()) - .build()) + return OpenlayerClientImpl( + clientOptions + .httpClient( + OkHttpClient.builder() + .baseUrl(baseUrl) + .timeout(timeout) + .proxy(proxy) + .build() + ) + .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 ec87b53..0866f95 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 @@ -3,25 +3,20 @@ package com.openlayer.api.client.okhttp import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.Multimap +import com.openlayer.api.client.OpenlayerClientAsync +import com.openlayer.api.client.OpenlayerClientAsyncImpl +import com.openlayer.api.core.ClientOptions import java.net.Proxy import java.time.Clock import java.time.Duration -import java.util.Optional -import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpClient -import com.openlayer.api.client.OpenlayerClientAsync -import com.openlayer.api.client.OpenlayerClientAsyncImpl class OpenlayerOkHttpClientAsync private constructor() { companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() - @JvmStatic - fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() + @JvmStatic fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() } class Builder { @@ -37,21 +32,15 @@ class OpenlayerOkHttpClientAsync private constructor() { this.baseUrl = baseUrl } - fun jsonMapper(jsonMapper: JsonMapper) = apply { - clientOptions.jsonMapper(jsonMapper) - } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } - fun clock(clock: Clock) = apply { - clientOptions.clock(clock) - } + fun clock(clock: Clock) = apply { clientOptions.clock(clock) } fun headers(headers: Map>) = apply { clientOptions.headers(headers) } - fun putHeader(name: String, value: String) = apply { - clientOptions.putHeader(name, value) - } + fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) } fun putHeaders(name: String, values: Iterable) = apply { clientOptions.putHeaders(name, values) @@ -61,42 +50,34 @@ class OpenlayerOkHttpClientAsync private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { - clientOptions.removeHeader(name) - } + fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } - fun timeout(timeout: Duration) = apply { - this.timeout = timeout - } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } - fun maxRetries(maxRetries: Int) = apply { - clientOptions.maxRetries(maxRetries) - } + fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } - fun proxy(proxy: Proxy) = apply { - this.proxy = proxy - } + fun proxy(proxy: Proxy) = apply { this.proxy = proxy } fun responseValidation(responseValidation: Boolean) = apply { clientOptions.responseValidation(responseValidation) } - fun apiKey(apiKey: String?) = apply { - clientOptions.apiKey(apiKey) - } + fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } - fun fromEnv() = apply { - clientOptions.fromEnv() - } + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): OpenlayerClientAsync { - return OpenlayerClientAsyncImpl(clientOptions - .httpClient(OkHttpClient.builder() - .baseUrl(baseUrl) - .timeout(timeout) - .proxy(proxy) - .build()) - .build()) + return OpenlayerClientAsyncImpl( + clientOptions + .httpClient( + OkHttpClient.builder() + .baseUrl(baseUrl) + .timeout(timeout) + .proxy(proxy) + .build() + ) + .build() + ) } } } 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 95dd8b6..3a24286 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 @@ -4,27 +4,8 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture -import com.openlayer.api.core.ClientOptions -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.JsonField -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface OpenlayerClient { 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 f233b6c..7d8847c 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 @@ -4,27 +4,8 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture -import com.openlayer.api.core.ClientOptions -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.JsonField -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.async.* -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface OpenlayerClientAsync { 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 e53190b..d3c13ec 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 @@ -2,29 +2,17 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture import com.openlayer.api.core.ClientOptions -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.JsonField -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.async.* -import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler -class OpenlayerClientAsyncImpl constructor(private val clientOptions: ClientOptions, ) : OpenlayerClientAsync { +class OpenlayerClientAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : OpenlayerClientAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +22,9 @@ class OpenlayerClientAsyncImpl constructor(private val clientOptions: ClientOpti private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - private val inferencePipelines: InferencePipelineServiceAsync by lazy { InferencePipelineServiceAsyncImpl(clientOptions) } + private val inferencePipelines: InferencePipelineServiceAsync by lazy { + InferencePipelineServiceAsyncImpl(clientOptions) + } private val storage: StorageServiceAsync by lazy { StorageServiceAsyncImpl(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 2a97eb1..29a6187 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 @@ -2,29 +2,17 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture import com.openlayer.api.core.ClientOptions -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.JsonField -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* -import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler -class OpenlayerClientImpl constructor(private val clientOptions: ClientOptions, ) : OpenlayerClient { +class OpenlayerClientImpl +constructor( + private val clientOptions: ClientOptions, +) : OpenlayerClient { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +22,9 @@ class OpenlayerClientImpl constructor(private val clientOptions: ClientOptions, private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - private val inferencePipelines: InferencePipelineService by lazy { InferencePipelineServiceImpl(clientOptions) } + private val inferencePipelines: InferencePipelineService by lazy { + InferencePipelineServiceImpl(clientOptions) + } private val storage: StorageService by lazy { StorageServiceImpl(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 4a98458..0573e16 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 @@ -13,9 +13,13 @@ import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer import kotlin.reflect.KClass -abstract class BaseDeserializer(type: KClass) : StdDeserializer(type.java), ContextualDeserializer { +abstract class BaseDeserializer(type: KClass) : + StdDeserializer(type.java), ContextualDeserializer { - override fun createContextual(context: DeserializationContext, property: BeanProperty?): JsonDeserializer { + override fun createContextual( + context: DeserializationContext, + property: BeanProperty? + ): JsonDeserializer { return this } @@ -25,7 +29,11 @@ abstract class BaseDeserializer(type: KClass) : StdDeserializer(t protected abstract fun ObjectCodec.deserialize(node: JsonNode): T - protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: TypeReference, validate: (T) -> Unit = {}): T? { + protected fun ObjectCodec.tryDeserialize( + node: JsonNode, + type: TypeReference, + validate: (T) -> Unit = {} + ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) } catch (e: JsonMappingException) { @@ -35,7 +43,11 @@ abstract class BaseDeserializer(type: KClass) : StdDeserializer(t } } - protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: JavaType, validate: (T) -> Unit = {}): T? { + protected fun ObjectCodec.tryDeserialize( + node: JsonNode, + type: JavaType, + validate: (T) -> Unit = {} + ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) } catch (e: JsonMappingException) { 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 b3082ae..ed353b4 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 @@ -3,35 +3,31 @@ package com.openlayer.api.core import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.Multimap -import com.google.common.collect.ListMultimap import com.google.common.collect.ArrayListMultimap -import java.time.Clock -import java.util.Base64 +import com.google.common.collect.ListMultimap import com.openlayer.api.core.http.HttpClient import com.openlayer.api.core.http.RetryingHttpClient +import java.time.Clock -class ClientOptions private constructor( - @get:JvmName("httpClient") val httpClient: HttpClient, - @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, - @get:JvmName("clock") val clock: Clock, - @get:JvmName("baseUrl") val baseUrl: String, - @get:JvmName("apiKey") val apiKey: String?, - @get:JvmName("headers") val headers: ListMultimap, - @get:JvmName("queryParams") val queryParams: ListMultimap, - @get:JvmName("responseValidation") val responseValidation: Boolean, - +class ClientOptions +private constructor( + @get:JvmName("httpClient") val httpClient: HttpClient, + @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, + @get:JvmName("clock") val clock: Clock, + @get:JvmName("baseUrl") val baseUrl: String, + @get:JvmName("apiKey") val apiKey: String?, + @get:JvmName("headers") val headers: ListMultimap, + @get:JvmName("queryParams") val queryParams: ListMultimap, + @get:JvmName("responseValidation") val responseValidation: Boolean, ) { companion object { const val PRODUCTION_URL = "https://api.openlayer.com/v1" - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() - @JvmStatic - fun fromEnv(): ClientOptions = builder().fromEnv().build() + @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() } class Builder { @@ -46,21 +42,13 @@ class ClientOptions private constructor( private var maxRetries: Int = 2 private var apiKey: String? = null - fun httpClient(httpClient: HttpClient) = apply { - this.httpClient = httpClient - } + fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } - fun jsonMapper(jsonMapper: JsonMapper) = apply { - this.jsonMapper = jsonMapper - } + fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } - fun baseUrl(baseUrl: String) = apply { - this.baseUrl = baseUrl - } + fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } - fun clock(clock: Clock) = apply { - this.clock = clock - } + fun clock(clock: Clock) = apply { this.clock = clock } fun headers(headers: Map>) = apply { this.headers.clear() @@ -79,9 +67,7 @@ class ClientOptions private constructor( headers.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.headers.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.headers.put(name, mutableListOf()) } fun queryParams(queryParams: Map>) = apply { this.queryParams.clear() @@ -100,61 +86,49 @@ class ClientOptions private constructor( queryParams.forEach(this::putQueryParams) } - fun removeQueryParam(name: String) = apply { - this.queryParams.put(name, mutableListOf()) - } + fun removeQueryParam(name: String) = apply { this.queryParams.put(name, mutableListOf()) } fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } - fun maxRetries(maxRetries: Int) = apply { - this.maxRetries = maxRetries - } + fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } - fun apiKey(apiKey: String?) = apply { - this.apiKey = apiKey - } + fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } - fun fromEnv() = apply { - System.getenv("OPENLAYER_API_KEY")?.let { - apiKey(it) - } - } + fun fromEnv() = apply { System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } } fun build(): ClientOptions { - checkNotNull(httpClient) { - "`httpClient` is required but was not set" - } - - val headers = ArrayListMultimap.create() - val queryParams = ArrayListMultimap.create() - headers.put("X-Stainless-Lang", "java") - headers.put("X-Stainless-Arch", getOsArch()) - headers.put("X-Stainless-OS", getOsName()) - headers.put("X-Stainless-OS-Version", getOsVersion()) - headers.put("X-Stainless-Package-Version", getPackageVersion()) - headers.put("X-Stainless-Runtime-Version", getJavaVersion()) - if (!apiKey.isNullOrEmpty()) { - headers.put("Authorization", "Bearer ${apiKey}") - } - this.headers.forEach(headers::replaceValues) - this.queryParams.forEach(queryParams::replaceValues) - - return ClientOptions( - RetryingHttpClient.builder() - .httpClient(httpClient!!) - .clock(clock) - .maxRetries(maxRetries) - .build(), - jsonMapper ?: jsonMapper(), - clock, - baseUrl, - apiKey, - headers.toUnmodifiable(), - queryParams.toUnmodifiable(), - responseValidation, - ) + checkNotNull(httpClient) { "`httpClient` is required but was not set" } + + val headers = ArrayListMultimap.create() + val queryParams = ArrayListMultimap.create() + headers.put("X-Stainless-Lang", "java") + headers.put("X-Stainless-Arch", getOsArch()) + headers.put("X-Stainless-OS", getOsName()) + headers.put("X-Stainless-OS-Version", getOsVersion()) + headers.put("X-Stainless-Package-Version", getPackageVersion()) + headers.put("X-Stainless-Runtime-Version", getJavaVersion()) + if (!apiKey.isNullOrEmpty()) { + headers.put("Authorization", "Bearer ${apiKey}") + } + this.headers.forEach(headers::replaceValues) + this.queryParams.forEach(queryParams::replaceValues) + + return ClientOptions( + RetryingHttpClient.builder() + .httpClient(httpClient!!) + .clock(clock) + .maxRetries(maxRetries) + .build(), + jsonMapper ?: jsonMapper(), + clock, + baseUrl, + apiKey, + headers.toUnmodifiable(), + queryParams.toUnmodifiable(), + responseValidation, + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt index 505acea..bc0d02a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt @@ -9,9 +9,12 @@ fun getOsArch(): String { return when (osArch) { null -> "unknown" - "i386", "x32", "x86" -> "x32" - "amd64", "x86_64" -> "x64" - "arm"-> "arm" + "i386", + "x32", + "x86" -> "x32" + "amd64", + "x86_64" -> "x64" + "arm" -> "arm" "aarch64" -> "arm64" else -> "other:${osArch}" } @@ -36,7 +39,7 @@ fun getOsVersion(): String { } fun getPackageVersion(): String { - return Properties::class.java.`package`.implementationVersion ?: "unknown"; + return Properties::class.java.`package`.implementationVersion ?: "unknown" } fun getJavaVersion(): String { 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 0752435..2b862a3 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 @@ -31,9 +31,7 @@ private constructor( this.responseValidation = responseValidation } - fun timeout(timeout: Duration) = apply { - this.timeout = timeout - } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } fun build(): RequestOptions { return RequestOptions(responseValidation, timeout) 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 311b40e..8f46e25 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 @@ -48,10 +48,10 @@ internal fun ListMultimap.toUnmodifiable(): ListMultimap { internal fun ListMultimap.getRequiredHeader(header: String): String { val value = entries() - .stream() - .filter { entry -> entry.key.equals(header, ignoreCase = true) } - .map { entry -> entry.value } - .findFirst() + .stream() + .filter { entry -> entry.key.equals(header, ignoreCase = true) } + .map { entry -> entry.value } + .findFirst() if (!value.isPresent) { throw OpenlayerInvalidDataException("Could not find $header header") } 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 826a2c8..12b454f 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 @@ -6,7 +6,6 @@ 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 -import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.BeanProperty @@ -17,8 +16,6 @@ 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.databind.deser.ContextualDeserializer -import com.fasterxml.jackson.databind.deser.std.StdDeserializer import com.fasterxml.jackson.databind.node.JsonNodeType.ARRAY import com.fasterxml.jackson.databind.node.JsonNodeType.BINARY import com.fasterxml.jackson.databind.node.JsonNodeType.BOOLEAN @@ -29,15 +26,14 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.OBJECT 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 java.util.Optional +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.nio.charset.Charset import java.util.Objects -import java.io.ByteArrayOutputStream +import java.util.Optional import org.apache.hc.core5.http.ContentType -import java.nio.charset.Charset -import com.openlayer.api.errors.OpenlayerInvalidDataException @JsonDeserialize(using = JsonField.Deserializer::class) -sealed class JsonField { +sealed class JsonField { fun isMissing(): Boolean = this is JsonMissing @@ -50,9 +46,9 @@ sealed class JsonField { } /** - * 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`. + * 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`. */ fun asUnknown(): Optional = when (this) { @@ -127,13 +123,12 @@ sealed class JsonField { is JsonValue -> accept(visitor as JsonValue.Visitor) } - interface Visitor: JsonValue.Visitor { + interface Visitor : JsonValue.Visitor { fun visitKnown(value: T): R = visitDefault() } companion object { - @JvmStatic - fun of(value: T): JsonField = KnownValue.of(value) + @JvmStatic fun of(value: T): JsonField = KnownValue.of(value) @JvmStatic fun ofNullable(value: T?): JsonField = @@ -160,11 +155,8 @@ sealed class JsonField { } override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> { - return type?.let { - tryDeserialize(node, type) - }?.let { - of(it) - } ?: JsonValue.fromJsonNode(node) + return type?.let { tryDeserialize(node, type) }?.let { of(it) } + ?: JsonValue.fromJsonNode(node) } override fun getNullValue(context: DeserializationContext): JsonField<*> { @@ -174,11 +166,11 @@ sealed class JsonField { } @JsonDeserialize(using = JsonValue.Deserializer::class) -sealed class JsonValue: JsonField() { +sealed class JsonValue : JsonField() { - fun convert(type: TypeReference): R? = JSON_MAPPER.convertValue(this, type) + fun convert(type: TypeReference): R? = JSON_MAPPER.convertValue(this, type) - fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) + fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) fun accept(visitor: Visitor): R = when (this) { @@ -193,12 +185,19 @@ sealed class JsonValue: JsonField() { interface Visitor { fun visitNull(): R = visitDefault() + fun visitMissing(): R = visitDefault() + fun visitBoolean(value: Boolean): R = visitDefault() + fun visitNumber(value: Number): R = visitDefault() + fun visitString(value: String): R = visitDefault() + fun visitArray(values: List): R = visitDefault() + fun visitObject(values: Map): R = visitDefault() + fun visitDefault(): R { throw RuntimeException("Unexpected value") } @@ -224,8 +223,12 @@ sealed class JsonValue: JsonField() { BOOLEAN -> JsonBoolean.of(node.booleanValue()) NUMBER -> JsonNumber.of(node.numberValue()) STRING -> JsonString.of(node.textValue()) - ARRAY -> JsonArray.of(node.elements().asSequence().map { fromJsonNode(it) }.toList()) - OBJECT -> JsonObject.of(node.fields().asSequence().map { it.key to fromJsonNode(it.value) }.toMap()) + ARRAY -> + JsonArray.of(node.elements().asSequence().map { fromJsonNode(it) }.toList()) + OBJECT -> + JsonObject.of( + node.fields().asSequence().map { it.key to fromJsonNode(it.value) }.toMap() + ) BINARY, POJO, null -> throw IllegalStateException("Unexpected JsonNode type: ${node.nodeType}") @@ -243,7 +246,10 @@ sealed class JsonValue: JsonField() { } } -class KnownValue private constructor(@com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T) : JsonField() { +class KnownValue +private constructor( + @com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T +) : JsonField() { override fun equals(other: Any?): Boolean { if (this === other) { @@ -258,7 +264,7 @@ class KnownValue private constructor(@com.fasterxml.jackson.annotation. override fun toString() = value.toString() companion object { - @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) + @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) } } @@ -273,11 +279,14 @@ class JsonMissing : JsonValue() { @JvmStatic fun of() = INSTANCE } - class Serializer: BaseSerializer(JsonMissing::class) { - override fun serialize(value: JsonMissing, generator: JsonGenerator, provider: SerializerProvider) { + class Serializer : BaseSerializer(JsonMissing::class) { + override fun serialize( + value: JsonMissing, + generator: JsonGenerator, + provider: SerializerProvider + ) { throw RuntimeException("JsonMissing cannot be serialized") } - } } @@ -378,9 +387,7 @@ private constructor( override fun toString() = values.toString() companion object { - @JsonCreator - @JvmStatic - fun of(values: List) = JsonArray(values.toUnmodifiable()) + @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toUnmodifiable()) } } @@ -417,18 +424,18 @@ private constructor( ) annotation class ExcludeMissing - @JacksonAnnotationsInside @JsonAutoDetect( getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE) + fieldVisibility = Visibility.NONE +) annotation class NoAutoDetect - -class MultipartFormValue internal constructor( +class MultipartFormValue +internal constructor( val name: String, val value: T, val contentType: ContentType, @@ -439,16 +446,20 @@ class MultipartFormValue internal constructor( 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() - } - ) + 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 } @@ -459,7 +470,8 @@ class MultipartFormValue internal constructor( other as MultipartFormValue<*> - if (name != other.name || contentType != other.contentType || filename != other.filename) return false + if (name != other.name || contentType != other.contentType || filename != other.filename) + return false return when { value is ByteArray && other.value is ByteArray -> value contentEquals other.value @@ -471,10 +483,11 @@ class MultipartFormValue internal constructor( return "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() - } + private fun valueToString(): String = + when (value) { + is ByteArray -> "ByteArray of size ${value.size}" + else -> value.toString() + } companion object { internal fun fromString( @@ -484,27 +497,27 @@ class MultipartFormValue internal constructor( ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromBoolean( - name: String, - value: Boolean, - contentType: ContentType, + name: String, + value: Boolean, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromLong( - name: String, - value: Long, - contentType: ContentType, + name: String, + value: Long, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromDouble( - name: String, - value: Double, - contentType: ContentType, + name: String, + value: Double, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) - internal fun fromEnum( - name: String, - value: T, - contentType: ContentType + internal fun fromEnum( + name: String, + value: T, + contentType: ContentType ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromByteArray( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt index a324305..4c099ff 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt @@ -1,9 +1,8 @@ package com.openlayer.api.core.http -import com.google.common.collect.ListMultimap import java.io.Closeable -import java.io.InputStream import java.io.IOException +import java.io.InputStream import java.io.OutputStream interface BinaryResponseContent : Closeable { 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 f492388..b9cac17 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,8 +1,8 @@ package com.openlayer.api.core.http +import com.openlayer.api.core.RequestOptions import java.io.Closeable import java.util.concurrent.CompletableFuture -import com.openlayer.api.core.RequestOptions interface HttpClient : Closeable { 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 53d1d41..243c19a 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 @@ -5,7 +5,6 @@ import com.google.common.collect.ListMultimap import com.google.common.collect.Multimap import com.google.common.collect.MultimapBuilder import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.core.RequestOptions class HttpRequest private constructor( 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 402d902..4f4dbd1 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 @@ -13,10 +13,11 @@ interface HttpRequestBody : Closeable { fun contentLength(): Long /** - * Determines if a request can be repeated in a meaningful way, for example before doing a retry. + * Determines if a request can be repeated in a meaningful way, for example before doing a + * retry. * - * The most typical case when a request can't be retried is if the request body is being streamed. In this case the - * body data isn't available on subsequent attempts. + * The most typical case when a request can't be retried is if the request body is being + * streamed. In this case the body data isn't available on subsequent attempts. */ fun repeatable(): Boolean 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 f870b89..a90d6f4 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 @@ -3,8 +3,8 @@ package com.openlayer.api.core.http import com.google.common.util.concurrent.MoreExecutors -import com.openlayer.api.errors.OpenlayerIoException import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.time.Clock import java.time.Duration @@ -24,15 +24,15 @@ import kotlin.math.pow class RetryingHttpClient private constructor( - private val httpClient: HttpClient, - private val clock: Clock, - private val maxRetries: Int, - private val idempotencyHeader: String?, + private val httpClient: HttpClient, + private val clock: Clock, + private val maxRetries: Int, + private val idempotencyHeader: String?, ) : HttpClient { override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, + request: HttpRequest, + requestOptions: RequestOptions, ): HttpResponse { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.execute(request, requestOptions) @@ -44,29 +44,29 @@ private constructor( while (true) { val response = - try { - val response = httpClient.execute(request, requestOptions) - if (++retries > maxRetries || !shouldRetry(response)) { - return response - } - - response - } catch (t: Throwable) { - if (++retries > maxRetries || !shouldRetry(t)) { - throw t - } + try { + val response = httpClient.execute(request, requestOptions) + if (++retries > maxRetries || !shouldRetry(response)) { + return response + } - null + response + } catch (t: Throwable) { + if (++retries > maxRetries || !shouldRetry(t)) { + throw t } + null + } + val backoffMillis = getRetryBackoffMillis(retries, response) Thread.sleep(backoffMillis.toMillis()) } } override fun executeAsync( - request: HttpRequest, - requestOptions: RequestOptions, + request: HttpRequest, + requestOptions: RequestOptions, ): CompletableFuture { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.executeAsync(request, requestOptions) @@ -78,31 +78,31 @@ private constructor( fun wrap(future: CompletableFuture): CompletableFuture { return future - .handleAsync( - fun( - response: HttpResponse?, - throwable: Throwable? - ): CompletableFuture { - if (response != null) { - if (++retries > maxRetries || !shouldRetry(response)) { - return CompletableFuture.completedFuture(response) - } - } else { - if (++retries > maxRetries || !shouldRetry(throwable!!)) { - val failedFuture = CompletableFuture() - failedFuture.completeExceptionally(throwable) - return failedFuture - } - } - - val backoffMillis = getRetryBackoffMillis(retries, response) - return sleepAsync(backoffMillis.toMillis()).thenCompose { - wrap(httpClient.executeAsync(request, requestOptions)) - } - }, - MoreExecutors.directExecutor() - ) - .thenCompose(Function.identity()) + .handleAsync( + fun( + response: HttpResponse?, + throwable: Throwable? + ): CompletableFuture { + if (response != null) { + if (++retries > maxRetries || !shouldRetry(response)) { + return CompletableFuture.completedFuture(response) + } + } else { + if (++retries > maxRetries || !shouldRetry(throwable!!)) { + val failedFuture = CompletableFuture() + failedFuture.completeExceptionally(throwable) + return failedFuture + } + } + + val backoffMillis = getRetryBackoffMillis(retries, response) + return sleepAsync(backoffMillis.toMillis()).thenCompose { + wrap(httpClient.executeAsync(request, requestOptions)) + } + }, + MoreExecutors.directExecutor() + ) + .thenCompose(Function.identity()) } return wrap(httpClient.executeAsync(request, requestOptions)) @@ -158,30 +158,38 @@ private constructor( private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration { // About the Retry-After header: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After - response?.headers()?.let { headers -> - headers.get("Retry-After-Ms").getOrNull(0)?.toFloatOrNull()?.times(TimeUnit.MILLISECONDS.toNanos(1)) + response + ?.headers() + ?.let { headers -> + headers + .get("Retry-After-Ms") + .getOrNull(0) + ?.toFloatOrNull() + ?.times(TimeUnit.MILLISECONDS.toNanos(1)) ?: headers.get("Retry-After").getOrNull(0)?.let { retryAfter -> retryAfter.toFloatOrNull()?.times(TimeUnit.SECONDS.toNanos(1)) - ?: try { - ChronoUnit.MILLIS.between( - OffsetDateTime.now(clock), - OffsetDateTime.parse( - retryAfter, - DateTimeFormatter.RFC_1123_DATE_TIME - ) + ?: try { + ChronoUnit.MILLIS.between( + OffsetDateTime.now(clock), + OffsetDateTime.parse( + retryAfter, + DateTimeFormatter.RFC_1123_DATE_TIME ) - } catch (e: DateTimeParseException) { - null - } + ) + } catch (e: DateTimeParseException) { + null + } } - }?.let { retryAfterNanos -> - // If the API asks us to wait a certain amount of time (and it's a reasonable amount), just - // do what it says. - val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) - if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { - return retryAfter } - } + ?.let { retryAfterNanos -> + // If the API asks us to wait a certain amount of time (and it's a reasonable + // amount), just + // do what it says. + val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) + if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { + return retryAfter + } + } // Apply exponential backoff, but not more than the max. val backoffSeconds = min(0.5 * 2.0.pow(retries - 1), 8.0) @@ -195,12 +203,12 @@ private constructor( private fun sleepAsync(millis: Long): CompletableFuture { val future = CompletableFuture() TIMER.schedule( - object : TimerTask() { - override fun run() { - future.complete(null) - } - }, - millis + object : TimerTask() { + override fun run() { + future.complete(null) + } + }, + millis ) return future } @@ -209,8 +217,7 @@ private constructor( private val TIMER = Timer("RetryingHttpClient", true) - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -229,11 +236,11 @@ private constructor( fun idempotencyHeader(header: String) = apply { this.idempotencyHeader = header } fun build(): HttpClient = - RetryingHttpClient( - checkNotNull(httpClient) { "`httpClient` is required but was not set" }, - clock, - maxRetries, - idempotencyHeader, - ) + RetryingHttpClient( + checkNotNull(httpClient) { "`httpClient` is required but was not set" }, + clock, + maxRetries, + idempotencyHeader, + ) } } 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 c82ec23..f51b5d2 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 @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class BadRequestException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 400 + fun error(): OpenlayerError = error } 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 4108a62..b0c6a67 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 @@ -4,10 +4,11 @@ import com.google.common.collect.ListMultimap class InternalServerException constructor( - private val statusCode: Int, - headers: ListMultimap, - private val error: OpenlayerError, + private val statusCode: Int, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = statusCode + fun error(): OpenlayerError = 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 f5dd8ce..9efe856 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 @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class NotFoundException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 404 + fun error(): OpenlayerError = 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 11051a8..59250fe 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 @@ -5,51 +5,46 @@ 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 java.time.LocalDate -import java.time.OffsetDateTime -import java.util.Objects -import java.util.UUID -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import java.util.Objects @JsonDeserialize(builder = OpenlayerError.Builder::class) @NoAutoDetect -class OpenlayerError constructor(private val additionalProperties: Map, ) { +class OpenlayerError +constructor( + private val additionalProperties: Map, +) { - @JsonAnyGetter - fun additionalProperties(): Map = additionalProperties + @JsonAnyGetter fun additionalProperties(): Map = additionalProperties fun toBuilder() = Builder() override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is OpenlayerError && - this.additionalProperties == other.additionalProperties + return other is OpenlayerError && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - return Objects.hash(additionalProperties) + return Objects.hash(additionalProperties) } override fun toString() = "OpenlayerError{additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { private var additionalProperties: MutableMap = mutableMapOf() - fun from(error: OpenlayerError) = apply { - additionalProperties(error.additionalProperties) - } + fun from(error: OpenlayerError) = apply { additionalProperties(error.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() 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 2f9b4b4..916e4ed 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 @@ -5,10 +5,11 @@ import com.google.common.collect.ListMultimap abstract class OpenlayerServiceException @JvmOverloads constructor( - private val headers: ListMultimap, - message: String? = null, - cause: Throwable? = null + private val headers: ListMultimap, + message: String? = null, + cause: Throwable? = null ) : OpenlayerException(message, cause) { abstract fun statusCode(): Int + fun headers(): ListMultimap = headers } 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 511df28..cc7f0d6 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 @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class PermissionDeniedException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 403 + fun error(): OpenlayerError = 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 c930e91..5b83fd0 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 @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class RateLimitException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 429 + fun error(): OpenlayerError = 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 699feed..f0e8f0f 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 @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class UnauthorizedException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 401 + fun error(): OpenlayerError = error } 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 f0cef5c..30e8d3a 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 @@ -3,8 +3,12 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap class UnexpectedStatusCodeException -constructor(private val statusCode: Int, headers: ListMultimap, private val body: String) : - OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { +constructor( + private val statusCode: Int, + headers: ListMultimap, + private val body: String +) : OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { override fun statusCode(): Int = statusCode + fun body() = body } 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 992665e..87dba98 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 @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class UnprocessableEntityException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 422 + fun error(): OpenlayerError = 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 e27c81a..6b1c3e4 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 @@ -2,51 +2,28 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class CommitTestResultListParams constructor( - private val projectVersionId: String, - private val includeArchived: Boolean?, - private val page: Long?, - private val perPage: Long?, - private val status: Status?, - private val type: Type?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class CommitTestResultListParams +constructor( + private val projectVersionId: String, + private val includeArchived: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun projectVersionId(): String = projectVersionId @@ -63,34 +40,23 @@ class CommitTestResultListParams constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.includeArchived?.let { - params.put("includeArchived", listOf(it.toString())) - } - this.page?.let { - params.put("page", listOf(it.toString())) - } - this.perPage?.let { - params.put("perPage", listOf(it.toString())) - } - this.status?.let { - params.put("status", listOf(it.toString())) - } - this.type?.let { - params.put("type", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.includeArchived?.let { params.put("includeArchived", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.status?.let { params.put("status", listOf(it.toString())) } + this.type?.let { params.put("type", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectVersionId - else -> "" - } + return when (index) { + 0 -> projectVersionId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -100,44 +66,44 @@ class CommitTestResultListParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListParams && - this.projectVersionId == other.projectVersionId && - this.includeArchived == other.includeArchived && - this.page == other.page && - this.perPage == other.perPage && - this.status == other.status && - this.type == other.type && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is CommitTestResultListParams && + this.projectVersionId == other.projectVersionId && + this.includeArchived == other.includeArchived && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectVersionId, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectVersionId, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -176,30 +142,22 @@ class CommitTestResultListParams 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 } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { - this.perPage = perPage - } + fun perPage(perPage: Long) = apply { this.perPage = perPage } /** - * Filter list of test results by status. Available statuses are `running`, - * `passing`, `failing`, `skipped`, and `error`. + * 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: Status) = apply { this.status = status } /** * 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: Type) = apply { this.type = type } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -239,9 +197,7 @@ class CommitTestResultListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -252,37 +208,39 @@ class CommitTestResultListParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): CommitTestResultListParams = CommitTestResultListParams( - checkNotNull(projectVersionId) { - "`projectVersionId` is required but was not set" - }, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): CommitTestResultListParams = + CommitTestResultListParams( + checkNotNull(projectVersionId) { "`projectVersionId` is required but was not set" }, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -321,39 +279,43 @@ class CommitTestResultListParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } - class Type @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Type && - this.value == other.value + return other is Type && this.value == other.value } override fun hashCode() = value.hashCode() @@ -392,23 +354,25 @@ class CommitTestResultListParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - INTEGRITY -> Value.INTEGRITY - CONSISTENCY -> Value.CONSISTENCY - PERFORMANCE -> Value.PERFORMANCE - FAIRNESS -> Value.FAIRNESS - ROBUSTNESS -> Value.ROBUSTNESS - else -> Value._UNKNOWN - } - - 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") - } + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 d708086..731f3b5 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 @@ -5,37 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize 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 java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable 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 private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { +class CommitTestResultListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +45,9 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +55,43 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): CommitTestResultListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is CommitTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -114,17 +111,13 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } 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 } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +133,23 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.putAll(additionalProperties) } - fun build(): CommitTestResultListResponse = CommitTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): CommitTestResultListResponse = + CommitTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -175,24 +169,16 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +186,49 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +254,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +262,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +270,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +278,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,32 +294,33 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item 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, - + class Item + 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, ) { private var validated: Boolean = false @@ -356,10 +336,12 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) /** The project version (commit) id. */ - fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -368,35 +350,30 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The data start date. */ - fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) /** The data end date. */ - fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) /** The status of the test. */ fun status(): Status = status.getRequired("status") /** The status message. */ - fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** Project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("goal") - @ExcludeMissing - fun _goal() = goal + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun _goalId() = goalId + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun _projectVersionId() = projectVersionId + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -404,34 +381,22 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun _inferencePipelineId() = inferencePipelineId /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun _dateDataStarts() = dateDataStarts + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun _dateDataEnds() = dateDataEnds + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds /** The status of the test. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage @JsonAnyGetter @ExcludeMissing @@ -439,69 +404,70 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): Item = apply { if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -541,17 +507,13 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** Project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + 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 - } + fun goal(goal: JsonField) = apply { this.goal = goal } /** The test id. */ fun goalId(goalId: String) = goalId(JsonField.of(goalId)) @@ -559,12 +521,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test id. */ @JsonProperty("goalId") @ExcludeMissing - fun goalId(goalId: JsonField) = apply { - this.goalId = goalId - } + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = projectVersionId(JsonField.of(projectVersionId)) + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) /** The project version (commit) id. */ @JsonProperty("projectVersionId") @@ -574,7 +535,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = inferencePipelineId(JsonField.of(inferencePipelineId)) + fun inferencePipelineId(inferencePipelineId: String) = + inferencePipelineId(JsonField.of(inferencePipelineId)) /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -604,7 +566,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = dateDataStarts(JsonField.of(dateDataStarts)) + fun dateDataStarts(dateDataStarts: OffsetDateTime) = + dateDataStarts(JsonField.of(dateDataStarts)) /** The data start date. */ @JsonProperty("dateDataStarts") @@ -614,7 +577,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = dateDataEnds(JsonField.of(dateDataEnds)) + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) /** The data end date. */ @JsonProperty("dateDataEnds") @@ -629,9 +593,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The status of the test. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + fun status(status: JsonField) = apply { this.status = status } /** The status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -657,34 +619,37 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = + Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -723,54 +688,56 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi _UNKNOWN, } - fun value(): Value = when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = Goal.Builder::class) @NoAutoDetect - class Goal 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, - + class Goal + 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, ) { private var validated: Boolean = false @@ -792,14 +759,13 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** 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 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")) + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) /** The test type. */ fun type(): String = type.getRequired("type") @@ -808,18 +774,22 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun subtype(): String = subtype.getRequired("subtype") /** The test creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + fun originProjectVersionId(): Optional = + Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) fun thresholds(): List = thresholds.getRequired("thresholds") /** Whether the test is archived. */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = + Optional.ofNullable(archived.getNullable("archived")) /** The date the test was archived. */ - fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** Whether the test is suggested or user-created. */ fun suggested(): Boolean = suggested.getRequired("suggested") @@ -828,111 +798,81 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun commentCount(): Long = commentCount.getRequired("commentCount") /** Whether the test uses an ML model. */ - fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = + Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + fun usesTrainingDataset(): Optional = + Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(): Optional = Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + 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")) + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** The test id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The test number. */ - @JsonProperty("number") - @ExcludeMissing - fun _number() = number + @JsonProperty("number") @ExcludeMissing fun _number() = number /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The test description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description - /** - * 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. */ @JsonProperty("evaluationWindow") @ExcludeMissing fun _evaluationWindow() = evaluationWindow /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") - @ExcludeMissing - fun _delayWindow() = delayWindow + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun _type() = type + @JsonProperty("type") @ExcludeMissing fun _type() = type /** The test subtype. */ - @JsonProperty("subtype") - @ExcludeMissing - fun _subtype() = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype /** The test creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @ExcludeMissing fun _originProjectVersionId() = originProjectVersionId - @JsonProperty("thresholds") - @ExcludeMissing - fun _thresholds() = thresholds + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds /** Whether the test is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived /** The date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun _suggested() = suggested + @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun _commentCount() = commentCount + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") - @ExcludeMissing - fun _usesMlModel() = usesMlModel + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -960,101 +900,102 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi 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 + 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 } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = 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, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + 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, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1116,9 +1057,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) @@ -1126,9 +1065,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test number. */ @JsonProperty("number") @ExcludeMissing - fun number(number: JsonField) = apply { - this.number = number - } + fun number(number: JsonField) = apply { this.number = number } /** The test name. */ fun name(name: String) = name(JsonField.of(name)) @@ -1136,12 +1073,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) /** The creation date. */ @JsonProperty("dateCreated") @@ -1151,7 +1087,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ @JsonProperty("dateUpdated") @@ -1163,19 +1100,16 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonValue) = apply { - this.description = description - } + fun description(description: JsonValue) = apply { this.description = description } /** - * 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. */ - fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(JsonField.of(evaluationWindow)) + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(JsonField.of(evaluationWindow)) /** - * 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. */ @JsonProperty("evaluationWindow") @ExcludeMissing @@ -1199,9 +1133,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test type. */ @JsonProperty("type") @ExcludeMissing - fun type(type: JsonField) = apply { - this.type = type - } + fun type(type: JsonField) = apply { this.type = type } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) @@ -1209,9 +1141,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test subtype. */ @JsonProperty("subtype") @ExcludeMissing - fun subtype(subtype: JsonField) = apply { - this.subtype = subtype - } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The test creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -1219,12 +1149,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + 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)) + fun originProjectVersionId(originProjectVersionId: String) = + originProjectVersionId(JsonField.of(originProjectVersionId)) /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @@ -1247,12 +1176,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** Whether the test is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { - this.archived = archived - } + fun archived(archived: JsonField) = apply { this.archived = archived } /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) /** The date the test was archived. */ @JsonProperty("dateArchived") @@ -1267,9 +1195,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** Whether the test is suggested or user-created. */ @JsonProperty("suggested") @ExcludeMissing - fun suggested(suggested: JsonField) = apply { - this.suggested = suggested - } + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) @@ -1292,7 +1218,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -1302,7 +1229,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) /** Whether the test uses a training dataset. */ @JsonProperty("usesTrainingDataset") @@ -1312,7 +1240,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @@ -1322,7 +1251,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) /** Whether the test uses production data (monitoring mode only). */ @JsonProperty("usesProductionData") @@ -1341,47 +1271,49 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Goal = Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties.toUnmodifiable(), - ) + fun build(): Goal = + Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Threshold.Builder::class) @NoAutoDetect - class Threshold 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, - + class Threshold + 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, ) { private var validated: Boolean = false @@ -1389,42 +1321,38 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi private var hashCode: Int = 0 /** The measurement to be evaluated. */ - fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) /** The insight name to be evaluated. */ - fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = + Optional.ofNullable(insightName.getNullable("insightName")) - fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) /** The operator to be used for the evaluation. */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = + Optional.ofNullable(operator.getNullable("operator")) /** The value to be compared. */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) /** The measurement to be evaluated. */ - @JsonProperty("measurement") - @ExcludeMissing - fun _measurement() = measurement + @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement /** The insight name to be evaluated. */ - @JsonProperty("insightName") - @ExcludeMissing - fun _insightName() = insightName + @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName @JsonProperty("insightParameters") @ExcludeMissing fun _insightParameters() = insightParameters /** The operator to be used for the evaluation. */ - @JsonProperty("operator") - @ExcludeMissing - fun _operator() = operator + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator /** The value to be compared. */ - @JsonProperty("value") - @ExcludeMissing - fun _value() = value + @JsonProperty("value") @ExcludeMissing fun _value() = value @JsonAnyGetter @ExcludeMissing @@ -1432,51 +1360,52 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): Threshold = apply { if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + measurement() + insightName() + insightParameters() + operator() + value() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1518,7 +1447,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.insightName = insightName } - fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) @JsonProperty("insightParameters") @ExcludeMissing @@ -1532,9 +1462,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The operator to be used for the evaluation. */ @JsonProperty("operator") @ExcludeMissing - fun operator(operator: JsonField) = apply { - this.operator = operator - } + fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -1542,9 +1470,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The value to be compared. */ @JsonProperty("value") @ExcludeMissing - fun value(value: JsonField) = apply { - this.value = value - } + fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1556,114 +1482,126 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Threshold = Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) + fun build(): Threshold = + Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) - class Value private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, - private val string: String? = null, - private val strings: List? = null, - private val _json: JsonValue? = null, - + class Value + private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, ) { private var validated: Boolean = false fun double(): Optional = Optional.ofNullable(double) + fun boolean(): Optional = Optional.ofNullable(boolean) + fun string(): Optional = Optional.ofNullable(string) + fun strings(): Optional> = Optional.ofNullable(strings) fun isDouble(): Boolean = double != null + fun isBoolean(): Boolean = boolean != null + fun isString(): Boolean = string != null + fun isStrings(): Boolean = strings != null fun asDouble(): Double = double.getOrThrow("double") + fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + fun asString(): String = string.getOrThrow("string") + fun asStrings(): List = strings.getOrThrow("strings") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { - return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) - string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - else -> visitor.unknown(_json) - } + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } } fun validate(): Value = apply { if (!validated) { - if (double == null && boolean == null && string == null && strings == null) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true + if ( + double == null && + boolean == null && + string == null && + strings == null + ) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true } } override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings } override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) + return Objects.hash( + double, + boolean, + string, + strings, + ) } override fun toString(): String { - return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" - string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } } companion object { - @JvmStatic - fun ofDouble(double: Double) = Value(double = double) + @JvmStatic fun ofDouble(double: Double) = Value(double = double) - @JvmStatic - fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - @JvmStatic - fun ofString(string: String) = Value(string = string) + @JvmStatic fun ofString(string: String) = Value(string = string) - @JvmStatic - fun ofStrings(strings: List) = Value(strings = strings) + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) } interface Visitor { @@ -1677,42 +1615,46 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") + throw OpenlayerInvalidDataException("Unknown Value: $json") } } class Deserializer : BaseDeserializer(Value::class) { override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) } } class Serializer : BaseSerializer(Value::class) { - override fun serialize(value: Value, generator: JsonGenerator, provider: SerializerProvider) { - when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) - 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 serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + 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") + } } } } 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 dbb986c..62d6be9 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,46 +4,36 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize 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 org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow 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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class InferencePipelineDataStreamParams constructor( - private val inferencePipelineId: String, - private val config: Config, - private val rows: List, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class InferencePipelineDataStreamParams +constructor( + private val inferencePipelineId: String, + private val config: Config, + private val rows: List, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId @@ -54,42 +44,40 @@ class InferencePipelineDataStreamParams constructor( @JvmSynthetic internal fun getBody(): InferencePipelineDataStreamBody { - return InferencePipelineDataStreamBody( - config, - rows, - additionalBodyProperties, - ) + return InferencePipelineDataStreamBody( + config, + rows, + additionalBodyProperties, + ) } - @JvmSynthetic - internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } @JsonDeserialize(builder = InferencePipelineDataStreamBody.Builder::class) @NoAutoDetect - class InferencePipelineDataStreamBody internal constructor(private val config: Config?, private val rows: List?, private val additionalProperties: Map, ) { + class InferencePipelineDataStreamBody + internal constructor( + private val config: Config?, + private val rows: List?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. - */ - @JsonProperty("config") - fun config(): Config? = config + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + @JsonProperty("config") fun config(): Config? = config /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") - fun rows(): List? = rows + @JsonProperty("rows") fun rows(): List? = rows @JsonAnyGetter @ExcludeMissing @@ -98,33 +86,34 @@ class InferencePipelineDataStreamParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamBody && - this.config == other.config && - this.rows == other.rows && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamBody && + this.config == other.config && + this.rows == other.rows && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - config, - rows, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + config, + rows, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -134,26 +123,20 @@ class InferencePipelineDataStreamParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = apply { - this.config = inferencePipelineDataStreamBody.config - this.rows = inferencePipelineDataStreamBody.rows - additionalProperties(inferencePipelineDataStreamBody.additionalProperties) - } + internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = + apply { + this.config = inferencePipelineDataStreamBody.config + this.rows = inferencePipelineDataStreamBody.rows + additionalProperties(inferencePipelineDataStreamBody.additionalProperties) + } /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. + * Configuration for the data stream. Depends on your **Openlayer project task type**. */ - @JsonProperty("config") - fun config(config: Config) = apply { - this.config = config - } + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") - fun rows(rows: List) = apply { - this.rows = rows - } + @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -169,15 +152,12 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineDataStreamBody = InferencePipelineDataStreamBody( - checkNotNull(config) { - "`config` is required but was not set" - }, - checkNotNull(rows) { - "`rows` is required but was not set" - }.toUnmodifiable(), - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineDataStreamBody = + InferencePipelineDataStreamBody( + checkNotNull(config) { "`config` is required but was not set" }, + checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) } } @@ -188,38 +168,38 @@ class InferencePipelineDataStreamParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamParams && - this.inferencePipelineId == other.inferencePipelineId && - this.config == other.config && - this.rows == other.rows && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamParams && + this.inferencePipelineId == other.inferencePipelineId && + this.config == other.config && + this.rows == other.rows && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - config, - rows, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + config, + rows, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -233,55 +213,37 @@ class InferencePipelineDataStreamParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = apply { - this.inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId - this.config = inferencePipelineDataStreamParams.config - this.rows(inferencePipelineDataStreamParams.rows) - additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) - additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) - additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) - } + internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = + apply { + this.inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId + this.config = inferencePipelineDataStreamParams.config + this.rows(inferencePipelineDataStreamParams.rows) + additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) + additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) + additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId } - /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. - */ - fun config(config: Config) = apply { - this.config = config - } + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(config: Config) = apply { this.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) - } + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(llmData: Config.LlmData) = apply { this.config = Config.ofLlmData(llmData) } - /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. - */ + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(tabularClassificationData: Config.TabularClassificationData) = apply { this.config = Config.ofTabularClassificationData(tabularClassificationData) } - /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. - */ + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(tabularRegressionData: Config.TabularRegressionData) = apply { this.config = Config.ofTabularRegressionData(tabularRegressionData) } - /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. - */ + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(textClassificationData: Config.TextClassificationData) = apply { this.config = Config.ofTextClassificationData(textClassificationData) } @@ -293,9 +255,7 @@ class InferencePipelineDataStreamParams constructor( } /** A list of inference data points with inputs and outputs */ - fun addRow(row: Row) = apply { - this.rows.add(row) - } + fun addRow(row: Row) = apply { this.rows.add(row) } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -335,9 +295,7 @@ class InferencePipelineDataStreamParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -348,193 +306,232 @@ class InferencePipelineDataStreamParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): InferencePipelineDataStreamParams = InferencePipelineDataStreamParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - checkNotNull(config) { - "`config` is required but was not set" - }, - checkNotNull(rows) { - "`rows` is required but was not set" - }.toUnmodifiable(), - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineDataStreamParams = + InferencePipelineDataStreamParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + checkNotNull(config) { "`config` is required but was not set" }, + checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(using = Config.Deserializer::class) @JsonSerialize(using = Config.Serializer::class) - class Config private constructor( - private val llmData: LlmData? = null, - private val tabularClassificationData: TabularClassificationData? = null, - private val tabularRegressionData: TabularRegressionData? = null, - private val textClassificationData: TextClassificationData? = null, - private val _json: JsonValue? = null, - + class Config + private constructor( + private val llmData: LlmData? = null, + private val tabularClassificationData: TabularClassificationData? = null, + private val tabularRegressionData: TabularRegressionData? = null, + private val textClassificationData: TextClassificationData? = null, + private val _json: JsonValue? = null, ) { private var validated: Boolean = false fun llmData(): Optional = Optional.ofNullable(llmData) - fun tabularClassificationData(): Optional = Optional.ofNullable(tabularClassificationData) - fun tabularRegressionData(): Optional = Optional.ofNullable(tabularRegressionData) - fun textClassificationData(): Optional = Optional.ofNullable(textClassificationData) + + fun tabularClassificationData(): Optional = + Optional.ofNullable(tabularClassificationData) + + fun tabularRegressionData(): Optional = + Optional.ofNullable(tabularRegressionData) + + fun textClassificationData(): Optional = + Optional.ofNullable(textClassificationData) fun isLlmData(): Boolean = llmData != null + fun isTabularClassificationData(): Boolean = tabularClassificationData != null + fun isTabularRegressionData(): Boolean = tabularRegressionData != null + fun isTextClassificationData(): Boolean = textClassificationData != null fun asLlmData(): LlmData = llmData.getOrThrow("llmData") - fun asTabularClassificationData(): TabularClassificationData = tabularClassificationData.getOrThrow("tabularClassificationData") - fun asTabularRegressionData(): TabularRegressionData = tabularRegressionData.getOrThrow("tabularRegressionData") - fun asTextClassificationData(): TextClassificationData = textClassificationData.getOrThrow("textClassificationData") + + fun asTabularClassificationData(): TabularClassificationData = + tabularClassificationData.getOrThrow("tabularClassificationData") + + fun asTabularRegressionData(): TabularRegressionData = + tabularRegressionData.getOrThrow("tabularRegressionData") + + fun asTextClassificationData(): TextClassificationData = + textClassificationData.getOrThrow("textClassificationData") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { - return when { - llmData != null -> visitor.visitLlmData(llmData) - tabularClassificationData != null -> visitor.visitTabularClassificationData(tabularClassificationData) - tabularRegressionData != null -> visitor.visitTabularRegressionData(tabularRegressionData) - textClassificationData != null -> visitor.visitTextClassificationData(textClassificationData) - else -> visitor.unknown(_json) - } + return when { + llmData != null -> visitor.visitLlmData(llmData) + tabularClassificationData != null -> + visitor.visitTabularClassificationData(tabularClassificationData) + tabularRegressionData != null -> + visitor.visitTabularRegressionData(tabularRegressionData) + textClassificationData != null -> + visitor.visitTextClassificationData(textClassificationData) + else -> visitor.unknown(_json) + } } 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 ( + llmData == null && + tabularClassificationData == null && + tabularRegressionData == null && + textClassificationData == null + ) { + throw OpenlayerInvalidDataException("Unknown Config: $_json") + } + llmData?.validate() + tabularClassificationData?.validate() + tabularRegressionData?.validate() + textClassificationData?.validate() + validated = true } } override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - this.llmData == other.llmData && - this.tabularClassificationData == other.tabularClassificationData && - this.tabularRegressionData == other.tabularRegressionData && - this.textClassificationData == other.textClassificationData + if (this === other) { + return true + } + + return other is Config && + this.llmData == other.llmData && + this.tabularClassificationData == other.tabularClassificationData && + this.tabularRegressionData == other.tabularRegressionData && + this.textClassificationData == other.textClassificationData } override fun hashCode(): Int { - return Objects.hash( - llmData, - tabularClassificationData, - tabularRegressionData, - textClassificationData, - ) + return Objects.hash( + llmData, + tabularClassificationData, + tabularRegressionData, + textClassificationData, + ) } override fun toString(): String { - return when { - llmData != null -> "Config{llmData=$llmData}" - tabularClassificationData != null -> "Config{tabularClassificationData=$tabularClassificationData}" - tabularRegressionData != null -> "Config{tabularRegressionData=$tabularRegressionData}" - textClassificationData != null -> "Config{textClassificationData=$textClassificationData}" - _json != null -> "Config{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Config") - } + return when { + llmData != null -> "Config{llmData=$llmData}" + tabularClassificationData != null -> + "Config{tabularClassificationData=$tabularClassificationData}" + tabularRegressionData != null -> + "Config{tabularRegressionData=$tabularRegressionData}" + textClassificationData != null -> + "Config{textClassificationData=$textClassificationData}" + _json != null -> "Config{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Config") + } } companion object { - @JvmStatic - fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) + @JvmStatic fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) @JvmStatic - fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = Config(tabularClassificationData = tabularClassificationData) + fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = + Config(tabularClassificationData = tabularClassificationData) @JvmStatic - fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = Config(tabularRegressionData = tabularRegressionData) + fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = + Config(tabularRegressionData = tabularRegressionData) @JvmStatic - fun ofTextClassificationData(textClassificationData: TextClassificationData) = Config(textClassificationData = textClassificationData) + fun ofTextClassificationData(textClassificationData: TextClassificationData) = + Config(textClassificationData = textClassificationData) } interface Visitor { fun visitLlmData(llmData: LlmData): T - fun visitTabularClassificationData(tabularClassificationData: TabularClassificationData): T + fun visitTabularClassificationData( + tabularClassificationData: TabularClassificationData + ): T fun visitTabularRegressionData(tabularRegressionData: TabularRegressionData): T fun visitTextClassificationData(textClassificationData: TextClassificationData): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Config: $json") + throw OpenlayerInvalidDataException("Unknown Config: $json") } } class Deserializer : BaseDeserializer(Config::class) { 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 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) } } class Serializer : BaseSerializer(Config::class) { - override fun serialize(value: Config, generator: JsonGenerator, provider: SerializerProvider) { - when { - value.llmData != null -> generator.writeObject(value.llmData) - value.tabularClassificationData != null -> generator.writeObject(value.tabularClassificationData) - value.tabularRegressionData != null -> generator.writeObject(value.tabularRegressionData) - value.textClassificationData != null -> generator.writeObject(value.textClassificationData) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Config") - } + override fun serialize( + value: Config, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.llmData != null -> generator.writeObject(value.llmData) + value.tabularClassificationData != null -> + generator.writeObject(value.tabularClassificationData) + value.tabularRegressionData != null -> + generator.writeObject(value.tabularRegressionData) + value.textClassificationData != null -> + generator.writeObject(value.textClassificationData) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Config") + } } } @JsonDeserialize(builder = LlmData.Builder::class) @NoAutoDetect - class LlmData 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, - + class LlmData + 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, ) { private var validated: Boolean = false @@ -542,32 +539,38 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(): Optional = Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + fun numOfTokenColumnName(): Optional = + Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) /** - * Name of the column with the context retrieved. Applies to RAG use cases. - * Providing the context enables RAG-specific metrics. + * Name of the column with the context retrieved. Applies to RAG use cases. Providing + * the context enables RAG-specific metrics. */ - fun contextColumnName(): Optional = Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) + fun contextColumnName(): Optional = + Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) /** Name of the column with the cost associated with each row. */ - fun costColumnName(): Optional = Optional.ofNullable(costColumnName.getNullable("costColumnName")) + fun costColumnName(): Optional = + Optional.ofNullable(costColumnName.getNullable("costColumnName")) /** Name of the column with the ground truths. */ - fun groundTruthColumnName(): Optional = Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + 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. + * 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(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** Array of input variable names. Each input variable should be a dataset column. */ - fun inputVariableNames(): Optional> = Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) + fun inputVariableNames(): Optional> = + Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model outputs. */ fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") @@ -579,13 +582,15 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the questions. Applies to RAG use cases. Providing the * question enables RAG-specific metrics. */ - fun questionColumnName(): Optional = Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) + fun questionColumnName(): Optional = + Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** Name of the column with the total number of tokens. */ @JsonProperty("numOfTokenColumnName") @@ -593,17 +598,15 @@ class InferencePipelineDataStreamParams constructor( fun _numOfTokenColumnName() = numOfTokenColumnName /** - * Name of the column with the context retrieved. Applies to RAG use cases. - * Providing the context enables RAG-specific metrics. + * 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 /** Name of the column with the cost associated with each row. */ - @JsonProperty("costColumnName") - @ExcludeMissing - fun _costColumnName() = costColumnName + @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @@ -611,9 +614,8 @@ class InferencePipelineDataStreamParams constructor( fun _groundTruthColumnName() = 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. + * 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 @@ -630,9 +632,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model outputs. */ @JsonProperty("outputColumnName") @@ -640,9 +640,7 @@ class InferencePipelineDataStreamParams constructor( fun _outputColumnName() = outputColumnName /** Prompt for the LLM. */ - @JsonProperty("prompt") - @ExcludeMissing - fun _prompt() = prompt + @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -653,8 +651,8 @@ class InferencePipelineDataStreamParams constructor( fun _questionColumnName() = questionColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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 @@ -666,71 +664,72 @@ class InferencePipelineDataStreamParams constructor( fun validate(): LlmData = apply { if (!validated) { - numOfTokenColumnName() - contextColumnName() - costColumnName() - groundTruthColumnName() - inferenceIdColumnName() - inputVariableNames() - latencyColumnName() - outputColumnName() - prompt().map { it.forEach { it.validate() } } - questionColumnName() - timestampColumnName() - validated = true + numOfTokenColumnName() + contextColumnName() + costColumnName() + groundTruthColumnName() + inferenceIdColumnName() + inputVariableNames() + latencyColumnName() + outputColumnName() + prompt().map { it.forEach { it.validate() } } + questionColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LlmData && - this.numOfTokenColumnName == other.numOfTokenColumnName && - this.contextColumnName == other.contextColumnName && - this.costColumnName == other.costColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.inputVariableNames == other.inputVariableNames && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.outputColumnName == other.outputColumnName && - this.prompt == other.prompt && - this.questionColumnName == other.questionColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is LlmData && + this.numOfTokenColumnName == other.numOfTokenColumnName && + this.contextColumnName == other.contextColumnName && + this.costColumnName == other.costColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.inputVariableNames == other.inputVariableNames && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.outputColumnName == other.outputColumnName && + this.prompt == other.prompt && + this.questionColumnName == other.questionColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames, - latencyColumnName, - metadata, - outputColumnName, - prompt, - questionColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames, + latencyColumnName, + metadata, + outputColumnName, + prompt, + questionColumnName, + timestampColumnName, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -767,7 +766,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(numOfTokenColumnName: String) = numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) + fun numOfTokenColumnName(numOfTokenColumnName: String) = + numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) /** Name of the column with the total number of tokens. */ @JsonProperty("numOfTokenColumnName") @@ -780,7 +780,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the context retrieved. Applies to RAG use cases. * Providing the context enables RAG-specific metrics. */ - fun contextColumnName(contextColumnName: String) = contextColumnName(JsonField.of(contextColumnName)) + fun contextColumnName(contextColumnName: String) = + contextColumnName(JsonField.of(contextColumnName)) /** * Name of the column with the context retrieved. Applies to RAG use cases. @@ -793,7 +794,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the cost associated with each row. */ - fun costColumnName(costColumnName: String) = costColumnName(JsonField.of(costColumnName)) + fun costColumnName(costColumnName: String) = + costColumnName(JsonField.of(costColumnName)) /** Name of the column with the cost associated with each row. */ @JsonProperty("costColumnName") @@ -803,7 +805,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the ground truths. */ - fun groundTruthColumnName(groundTruthColumnName: String) = groundTruthColumnName(JsonField.of(groundTruthColumnName)) + fun groundTruthColumnName(groundTruthColumnName: String) = + groundTruthColumnName(JsonField.of(groundTruthColumnName)) /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @@ -817,7 +820,8 @@ class InferencePipelineDataStreamParams constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -830,10 +834,15 @@ class InferencePipelineDataStreamParams constructor( this.inferenceIdColumnName = inferenceIdColumnName } - /** Array of input variable names. Each input variable should be a dataset column. */ - fun inputVariableNames(inputVariableNames: List) = inputVariableNames(JsonField.of(inputVariableNames)) + /** + * Array of input variable names. Each input variable should be a dataset column. + */ + fun inputVariableNames(inputVariableNames: List) = + inputVariableNames(JsonField.of(inputVariableNames)) - /** 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. + */ @JsonProperty("inputVariableNames") @ExcludeMissing fun inputVariableNames(inputVariableNames: JsonField>) = apply { @@ -841,7 +850,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -853,12 +863,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model outputs. */ - fun outputColumnName(outputColumnName: String) = outputColumnName(JsonField.of(outputColumnName)) + fun outputColumnName(outputColumnName: String) = + outputColumnName(JsonField.of(outputColumnName)) /** Name of the column with the model outputs. */ @JsonProperty("outputColumnName") @@ -873,15 +882,14 @@ class InferencePipelineDataStreamParams constructor( /** Prompt for the LLM. */ @JsonProperty("prompt") @ExcludeMissing - fun prompt(prompt: JsonField>) = apply { - this.prompt = prompt - } + fun prompt(prompt: JsonField>) = apply { this.prompt = prompt } /** * Name of the column with the questions. Applies to RAG use cases. Providing the * question enables RAG-specific metrics. */ - fun questionColumnName(questionColumnName: String) = questionColumnName(JsonField.of(questionColumnName)) + fun questionColumnName(questionColumnName: String) = + questionColumnName(JsonField.of(questionColumnName)) /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -894,14 +902,15 @@ class InferencePipelineDataStreamParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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: String) = timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = + 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. + * 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 @@ -919,30 +928,37 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): LlmData = LlmData( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames.map { it.toUnmodifiable() }, - latencyColumnName, - metadata, - outputColumnName, - prompt.map { it.toUnmodifiable() }, - questionColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): LlmData = + LlmData( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames.map { it.toUnmodifiable() }, + latencyColumnName, + metadata, + outputColumnName, + prompt.map { it.toUnmodifiable() }, + questionColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Prompt.Builder::class) @NoAutoDetect - class Prompt private constructor(private val role: JsonField, private val content: JsonField, private val additionalProperties: Map, ) { + class Prompt + private constructor( + private val role: JsonField, + private val content: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -952,17 +968,14 @@ class InferencePipelineDataStreamParams constructor( fun role(): Optional = Optional.ofNullable(role.getNullable("role")) /** Content of the prompt. */ - fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + fun content(): Optional = + Optional.ofNullable(content.getNullable("content")) /** Role of the prompt. */ - @JsonProperty("role") - @ExcludeMissing - fun _role() = role + @JsonProperty("role") @ExcludeMissing fun _role() = role /** Content of the prompt. */ - @JsonProperty("content") - @ExcludeMissing - fun _content() = content + @JsonProperty("content") @ExcludeMissing fun _content() = content @JsonAnyGetter @ExcludeMissing @@ -970,42 +983,43 @@ class InferencePipelineDataStreamParams constructor( fun validate(): Prompt = apply { if (!validated) { - role() - content() - validated = true + role() + content() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Prompt && - this.role == other.role && - this.content == other.content && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Prompt && + this.role == other.role && + this.content == other.content && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - role, - content, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + role, + content, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" + override fun toString() = + "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1027,9 +1041,7 @@ class InferencePipelineDataStreamParams constructor( /** Role of the prompt. */ @JsonProperty("role") @ExcludeMissing - fun role(role: JsonField) = apply { - this.role = role - } + fun role(role: JsonField) = apply { this.role = role } /** Content of the prompt. */ fun content(content: String) = content(JsonField.of(content)) @@ -1037,9 +1049,7 @@ class InferencePipelineDataStreamParams constructor( /** Content of the prompt. */ @JsonProperty("content") @ExcludeMissing - fun content(content: JsonField) = apply { - this.content = content - } + fun content(content: JsonField) = apply { this.content = content } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1051,34 +1061,36 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Prompt = Prompt( - role, - content, - additionalProperties.toUnmodifiable(), - ) + fun build(): Prompt = + Prompt( + role, + content, + additionalProperties.toUnmodifiable(), + ) } } } @JsonDeserialize(builder = TabularClassificationData.Builder::class) @NoAutoDetect - class TabularClassificationData 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, - + class TabularClassificationData + 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, ) { private var validated: Boolean = false @@ -1086,84 +1098,87 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ - fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + 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. + * 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")) + 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. + * 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(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. */ - fun labelColumnName(): Optional = Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Name of the column with the model's predictions as **lists of class probabilities**. */ - fun predictionScoresColumnName(): Optional = Optional.ofNullable(predictionScoresColumnName.getNullable("predictionScoresColumnName")) + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing fun _categoricalFeatureNames() = categoricalFeatureNames /** - * List of class names indexed by label integer in the dataset. E.g. ["Retained", - * "Exited"] when 0, 1 are in your label column. + * 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() = classNames /** Array with all input feature names. */ - @JsonProperty("featureNames") - @ExcludeMissing - fun _featureNames() = featureNames + @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = 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. + * 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() = inferenceIdColumnName /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. + * 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 @@ -1175,9 +1190,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1185,16 +1198,15 @@ class InferencePipelineDataStreamParams constructor( fun _predictionsColumnName() = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Name of the column with the model's predictions as **lists of class probabilities**. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing fun _predictionScoresColumnName() = predictionScoresColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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 @@ -1206,65 +1218,66 @@ class InferencePipelineDataStreamParams constructor( fun validate(): TabularClassificationData = apply { if (!validated) { - categoricalFeatureNames() - classNames() - featureNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - timestampColumnName() - validated = true + categoricalFeatureNames() + classNames() + featureNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularClassificationData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.classNames == other.classNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is TabularClassificationData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.classNames == other.classNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - categoricalFeatureNames, - classNames, - featureNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + categoricalFeatureNames, + classNames, + featureNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1291,36 +1304,39 @@ class InferencePipelineDataStreamParams constructor( this.latencyColumnName = tabularClassificationData.latencyColumnName this.metadata = tabularClassificationData.metadata this.predictionsColumnName = tabularClassificationData.predictionsColumnName - this.predictionScoresColumnName = tabularClassificationData.predictionScoresColumnName + this.predictionScoresColumnName = + tabularClassificationData.predictionScoresColumnName this.timestampColumnName = tabularClassificationData.timestampColumnName additionalProperties(tabularClassificationData.additionalProperties) } /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * 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 - } + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = + apply { + this.categoricalFeatureNames = categoricalFeatureNames + } /** - * List of class names indexed by label integer in the dataset. E.g. ["Retained", - * "Exited"] when 0, 1 are in your label column. + * 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. + * 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 @@ -1329,7 +1345,8 @@ class InferencePipelineDataStreamParams constructor( } /** Array with all input feature names. */ - fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) + fun featureNames(featureNames: List) = + featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ @JsonProperty("featureNames") @@ -1343,7 +1360,8 @@ class InferencePipelineDataStreamParams constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -1360,7 +1378,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the labels. The data in this column must be * **zero-indexed integers**, matching the list provided in `classNames`. */ - fun labelColumnName(labelColumnName: String) = labelColumnName(JsonField.of(labelColumnName)) + fun labelColumnName(labelColumnName: String) = + labelColumnName(JsonField.of(labelColumnName)) /** * Name of the column with the labels. The data in this column must be @@ -1373,7 +1392,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -1385,12 +1405,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1403,7 +1422,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** * Name of the column with the model's predictions as **lists of class @@ -1411,19 +1431,21 @@ class InferencePipelineDataStreamParams constructor( */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { - this.predictionScoresColumnName = predictionScoresColumnName - } + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = + apply { + this.predictionScoresColumnName = predictionScoresColumnName + } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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: String) = timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = + 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. + * 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 @@ -1441,39 +1463,41 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): TabularClassificationData = TabularClassificationData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - classNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): TabularClassificationData = + TabularClassificationData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + classNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = TabularRegressionData.Builder::class) @NoAutoDetect - class TabularRegressionData 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, - + class TabularRegressionData + 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, ) { private var validated: Boolean = false @@ -1481,53 +1505,56 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. */ - fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + fun categoricalFeatureNames(): Optional> = + Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) /** Array with all input feature names. */ - fun featureNames(): Optional> = Optional.ofNullable(featureNames.getNullable("featureNames")) + 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. + * 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(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model's predictions. */ - fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** Name of the column with the targets (ground truth values). */ - fun targetColumnName(): Optional = Optional.ofNullable(targetColumnName.getNullable("targetColumnName")) + 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. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing fun _categoricalFeatureNames() = categoricalFeatureNames /** Array with all input feature names. */ - @JsonProperty("featureNames") - @ExcludeMissing - fun _featureNames() = featureNames + @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = 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. + * 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 @@ -1539,9 +1566,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @@ -1554,8 +1579,8 @@ class InferencePipelineDataStreamParams constructor( fun _targetColumnName() = targetColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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 @@ -1567,59 +1592,60 @@ class InferencePipelineDataStreamParams constructor( fun validate(): TabularRegressionData = apply { if (!validated) { - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - latencyColumnName() - predictionsColumnName() - targetColumnName() - timestampColumnName() - validated = true + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + latencyColumnName() + predictionsColumnName() + targetColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularRegressionData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.targetColumnName == other.targetColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is TabularRegressionData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.targetColumnName == other.targetColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - categoricalFeatureNames, - featureNames, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + categoricalFeatureNames, + featureNames, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + override fun toString() = + "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1648,23 +1674,26 @@ class InferencePipelineDataStreamParams constructor( } /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * 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 - } + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = + apply { + this.categoricalFeatureNames = categoricalFeatureNames + } /** Array with all input feature names. */ - fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) + fun featureNames(featureNames: List) = + featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ @JsonProperty("featureNames") @@ -1678,7 +1707,8 @@ class InferencePipelineDataStreamParams constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -1692,7 +1722,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -1704,12 +1735,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model's predictions. */ - fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @@ -1719,7 +1749,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the targets (ground truth values). */ - fun targetColumnName(targetColumnName: String) = targetColumnName(JsonField.of(targetColumnName)) + fun targetColumnName(targetColumnName: String) = + targetColumnName(JsonField.of(targetColumnName)) /** Name of the column with the targets (ground truth values). */ @JsonProperty("targetColumnName") @@ -1729,14 +1760,15 @@ class InferencePipelineDataStreamParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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: String) = timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = + 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. + * 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 @@ -1754,38 +1786,40 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): TabularRegressionData = TabularRegressionData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): TabularRegressionData = + TabularRegressionData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = TextClassificationData.Builder::class) @NoAutoDetect - class TextClassificationData 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, - + class TextClassificationData + 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, ) { private var validated: Boolean = false @@ -1793,65 +1827,69 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** - * List of class names indexed by label integer in the dataset. E.g. ["Retained", - * "Exited"] when 0, 1 are in your label column. + * 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") /** - * 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. + * 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(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. */ - fun labelColumnName(): Optional = Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Name of the column with the model's predictions as **lists of class probabilities**. */ - fun predictionScoresColumnName(): Optional = Optional.ofNullable(predictionScoresColumnName.getNullable("predictionScoresColumnName")) + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) /** Name of the column with the text data. */ - fun textColumnName(): Optional = Optional.ofNullable(textColumnName.getNullable("textColumnName")) + 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. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. */ - fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + 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. + * 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() = 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. + * 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() = inferenceIdColumnName /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. + * 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 @@ -1863,9 +1901,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1873,21 +1909,18 @@ class InferencePipelineDataStreamParams constructor( fun _predictionsColumnName() = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Name of the column with the model's predictions as **lists of class probabilities**. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing fun _predictionScoresColumnName() = predictionScoresColumnName /** Name of the column with the text data. */ - @JsonProperty("textColumnName") - @ExcludeMissing - fun _textColumnName() = textColumnName + @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName() = textColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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 @@ -1899,62 +1932,63 @@ class InferencePipelineDataStreamParams constructor( fun validate(): TextClassificationData = apply { if (!validated) { - classNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - textColumnName() - timestampColumnName() - validated = true + classNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + textColumnName() + timestampColumnName() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TextClassificationData && - this.classNames == other.classNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.textColumnName == other.textColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is TextClassificationData && + this.classNames == other.classNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.textColumnName == other.textColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - classNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + classNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + override fun toString() = + "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1978,21 +2012,22 @@ class InferencePipelineDataStreamParams constructor( this.latencyColumnName = textClassificationData.latencyColumnName this.metadata = textClassificationData.metadata this.predictionsColumnName = textClassificationData.predictionsColumnName - this.predictionScoresColumnName = textClassificationData.predictionScoresColumnName + this.predictionScoresColumnName = + textClassificationData.predictionScoresColumnName this.textColumnName = textClassificationData.textColumnName this.timestampColumnName = textClassificationData.timestampColumnName additionalProperties(textClassificationData.additionalProperties) } /** - * List of class names indexed by label integer in the dataset. E.g. ["Retained", - * "Exited"] when 0, 1 are in your label column. + * 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. + * 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 @@ -2005,7 +2040,8 @@ class InferencePipelineDataStreamParams constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - fun inferenceIdColumnName(inferenceIdColumnName: String) = inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -2022,7 +2058,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the labels. The data in this column must be * **zero-indexed integers**, matching the list provided in `classNames`. */ - fun labelColumnName(labelColumnName: String) = labelColumnName(JsonField.of(labelColumnName)) + fun labelColumnName(labelColumnName: String) = + labelColumnName(JsonField.of(labelColumnName)) /** * Name of the column with the labels. The data in this column must be @@ -2035,7 +2072,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -2047,12 +2085,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model's predictions as **zero-indexed integers**. */ - fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -2065,7 +2102,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** * Name of the column with the model's predictions as **lists of class @@ -2073,12 +2111,14 @@ class InferencePipelineDataStreamParams constructor( */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { - this.predictionScoresColumnName = predictionScoresColumnName - } + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = + apply { + this.predictionScoresColumnName = predictionScoresColumnName + } /** Name of the column with the text data. */ - fun textColumnName(textColumnName: String) = textColumnName(JsonField.of(textColumnName)) + fun textColumnName(textColumnName: String) = + textColumnName(JsonField.of(textColumnName)) /** Name of the column with the text data. */ @JsonProperty("textColumnName") @@ -2088,14 +2128,15 @@ class InferencePipelineDataStreamParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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: String) = timestampColumnName(JsonField.of(timestampColumnName)) + fun timestampColumnName(timestampColumnName: String) = + 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. + * 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 @@ -2113,29 +2154,34 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): TextClassificationData = TextClassificationData( - classNames.map { it.toUnmodifiable() }, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): TextClassificationData = + TextClassificationData( + classNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) } } } @JsonDeserialize(builder = Row.Builder::class) @NoAutoDetect - class Row private constructor(private val additionalProperties: Map, ) { + class Row + private constructor( + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 @@ -2146,27 +2192,25 @@ class InferencePipelineDataStreamParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Row && - this.additionalProperties == other.additionalProperties + return other is Row && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode } override fun toString() = "Row{additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -2174,9 +2218,7 @@ class InferencePipelineDataStreamParams 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) } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() 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 5b3ebd0..087ceda 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 @@ -5,37 +5,25 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects @JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) @NoAutoDetect -class InferencePipelineDataStreamResponse private constructor(private val success: JsonField, private val additionalProperties: Map, ) { +class InferencePipelineDataStreamResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -43,9 +31,7 @@ class InferencePipelineDataStreamResponse private constructor(private val succes fun success(): Success = success.getRequired("success") - @JsonProperty("success") - @ExcludeMissing - fun _success() = success + @JsonProperty("success") @ExcludeMissing fun _success() = success @JsonAnyGetter @ExcludeMissing @@ -53,36 +39,36 @@ class InferencePipelineDataStreamResponse private constructor(private val succes fun validate(): InferencePipelineDataStreamResponse = apply { if (!validated) { - success() - validated = true + success() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is InferencePipelineDataStreamResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties + return other is InferencePipelineDataStreamResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode } - override fun toString() = "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -91,7 +77,9 @@ class InferencePipelineDataStreamResponse private constructor(private val succes private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse) = apply { + internal fun from( + inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse + ) = apply { this.success = inferencePipelineDataStreamResponse.success additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) } @@ -100,9 +88,7 @@ class InferencePipelineDataStreamResponse private constructor(private val succes @JsonProperty("success") @ExcludeMissing - fun success(success: JsonField) = apply { - this.success = success - } + fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -118,21 +104,24 @@ class InferencePipelineDataStreamResponse private constructor(private val succes this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineDataStreamResponse = InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineDataStreamResponse = + InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) } - class Success @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Success && - this.value == other.value + return other is Success && this.value == other.value } override fun hashCode() = value.hashCode() @@ -155,15 +144,17 @@ class InferencePipelineDataStreamResponse private constructor(private val succes _UNKNOWN, } - fun value(): Value = when (this) { - TRUE -> Value.TRUE - else -> Value._UNKNOWN - } - - fun known(): Known = when (this) { - TRUE -> Known.TRUE - else -> throw OpenlayerInvalidDataException("Unknown Success: $value") - } + fun value(): Value = + when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } fun asString(): String = _value().asStringOrThrow() } 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 cb4d161..a8072f9 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,47 +4,25 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow 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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class InferencePipelineRowUpdateParams constructor( - private val inferencePipelineId: String, - private val inferenceId: String, - private val row: JsonValue, - private val config: Config?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class InferencePipelineRowUpdateParams +constructor( + private val inferencePipelineId: String, + private val inferenceId: String, + private val row: JsonValue, + private val config: Config?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId @@ -57,44 +35,44 @@ class InferencePipelineRowUpdateParams constructor( @JvmSynthetic internal fun getBody(): InferencePipelineRowUpdateBody { - return InferencePipelineRowUpdateBody( - row, - config, - additionalBodyProperties, - ) + return InferencePipelineRowUpdateBody( + row, + config, + additionalBodyProperties, + ) } @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.inferenceId.let { - params.put("inferenceId", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.inferenceId.let { params.put("inferenceId", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } @JsonDeserialize(builder = InferencePipelineRowUpdateBody.Builder::class) @NoAutoDetect - class InferencePipelineRowUpdateBody internal constructor(private val row: JsonValue?, private val config: Config?, private val additionalProperties: Map, ) { + class InferencePipelineRowUpdateBody + internal constructor( + private val row: JsonValue?, + private val config: Config?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - @JsonProperty("row") - fun row(): JsonValue? = row + @JsonProperty("row") fun row(): JsonValue? = row - @JsonProperty("config") - fun config(): Config? = config + @JsonProperty("config") fun config(): Config? = config @JsonAnyGetter @ExcludeMissing @@ -103,33 +81,34 @@ class InferencePipelineRowUpdateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRowUpdateBody && - this.row == other.row && - this.config == other.config && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineRowUpdateBody && + this.row == other.row && + this.config == other.config && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - row, - config, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + row, + config, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -139,21 +118,16 @@ class InferencePipelineRowUpdateParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = apply { - this.row = inferencePipelineRowUpdateBody.row - this.config = inferencePipelineRowUpdateBody.config - additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) - } + internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = + apply { + this.row = inferencePipelineRowUpdateBody.row + this.config = inferencePipelineRowUpdateBody.config + additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) + } - @JsonProperty("row") - fun row(row: JsonValue) = apply { - this.row = row - } + @JsonProperty("row") fun row(row: JsonValue) = apply { this.row = row } - @JsonProperty("config") - fun config(config: Config) = apply { - this.config = config - } + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -169,13 +143,12 @@ class InferencePipelineRowUpdateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowUpdateBody = InferencePipelineRowUpdateBody( - checkNotNull(row) { - "`row` is required but was not set" - }, - config, - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineRowUpdateBody = + InferencePipelineRowUpdateBody( + checkNotNull(row) { "`row` is required but was not set" }, + config, + additionalProperties.toUnmodifiable(), + ) } } @@ -186,40 +159,40 @@ class InferencePipelineRowUpdateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRowUpdateParams && - this.inferencePipelineId == other.inferencePipelineId && - this.row == other.row && - this.config == other.config && - this.inferenceId == other.inferenceId && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineRowUpdateParams && + this.inferencePipelineId == other.inferencePipelineId && + this.row == other.row && + this.config == other.config && + this.inferenceId == other.inferenceId && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - row, - config, - inferenceId, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + row, + config, + inferenceId, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -234,32 +207,27 @@ class InferencePipelineRowUpdateParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = apply { - this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId - this.inferenceId = inferencePipelineRowUpdateParams.inferenceId - this.row = inferencePipelineRowUpdateParams.row - this.config = inferencePipelineRowUpdateParams.config - additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) - additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) - additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) - } + internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = + apply { + this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId + this.inferenceId = inferencePipelineRowUpdateParams.inferenceId + this.row = inferencePipelineRowUpdateParams.row + this.config = inferencePipelineRowUpdateParams.config + additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) + additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) + additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId } /** Specify the inference id as a query param. */ - fun inferenceId(inferenceId: String) = apply { - this.inferenceId = inferenceId - } + fun inferenceId(inferenceId: String) = apply { this.inferenceId = inferenceId } - fun row(row: JsonValue) = apply { - this.row = row - } + fun row(row: JsonValue) = apply { this.row = row } - fun config(config: Config) = apply { - this.config = config - } + fun config(config: Config) = apply { this.config = config } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -299,9 +267,7 @@ class InferencePipelineRowUpdateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -312,56 +278,52 @@ class InferencePipelineRowUpdateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - 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, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + 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, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Config.Builder::class) @NoAutoDetect - class Config 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, - + class Config + 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, ) { private var hashCode: Int = 0 /** - * 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. + * 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 /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - fun latencyColumnName(): String? = latencyColumnName + @JsonProperty("latencyColumnName") fun latencyColumnName(): String? = latencyColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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 @@ -381,39 +343,40 @@ class InferencePipelineRowUpdateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.timestampColumnName == other.timestampColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.humanFeedbackColumnName == other.humanFeedbackColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Config && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.timestampColumnName == other.timestampColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.humanFeedbackColumnName == other.humanFeedbackColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - inferenceIdColumnName, - latencyColumnName, - timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" + override fun toString() = + "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -436,9 +399,8 @@ class InferencePipelineRowUpdateParams constructor( } /** - * 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. + * 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 { @@ -452,8 +414,8 @@ class InferencePipelineRowUpdateParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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 { @@ -486,14 +448,15 @@ class InferencePipelineRowUpdateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Config = Config( - inferenceIdColumnName, - latencyColumnName, - timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): Config = + Config( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties.toUnmodifiable(), + ) } } } 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 04db454..35e877e 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 @@ -5,37 +5,25 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects @JsonDeserialize(builder = InferencePipelineRowUpdateResponse.Builder::class) @NoAutoDetect -class InferencePipelineRowUpdateResponse private constructor(private val success: JsonField, private val additionalProperties: Map, ) { +class InferencePipelineRowUpdateResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -43,9 +31,7 @@ class InferencePipelineRowUpdateResponse private constructor(private val success fun success(): Success = success.getRequired("success") - @JsonProperty("success") - @ExcludeMissing - fun _success() = success + @JsonProperty("success") @ExcludeMissing fun _success() = success @JsonAnyGetter @ExcludeMissing @@ -53,36 +39,36 @@ class InferencePipelineRowUpdateResponse private constructor(private val success fun validate(): InferencePipelineRowUpdateResponse = apply { if (!validated) { - success() - validated = true + success() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is InferencePipelineRowUpdateResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties + return other is InferencePipelineRowUpdateResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode } - override fun toString() = "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -91,18 +77,17 @@ class InferencePipelineRowUpdateResponse private constructor(private val success private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = apply { - this.success = inferencePipelineRowUpdateResponse.success - additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) - } + internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = + apply { + this.success = inferencePipelineRowUpdateResponse.success + additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) + } fun success(success: Success) = success(JsonField.of(success)) @JsonProperty("success") @ExcludeMissing - fun success(success: JsonField) = apply { - this.success = success - } + fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -118,21 +103,24 @@ class InferencePipelineRowUpdateResponse private constructor(private val success this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowUpdateResponse = InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineRowUpdateResponse = + InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) } - class Success @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Success && - this.value == other.value + return other is Success && this.value == other.value } override fun hashCode() = value.hashCode() @@ -155,15 +143,17 @@ class InferencePipelineRowUpdateResponse private constructor(private val success _UNKNOWN, } - fun value(): Value = when (this) { - TRUE -> Value.TRUE - else -> Value._UNKNOWN - } - - fun known(): Known = when (this) { - TRUE -> Known.TRUE - else -> throw OpenlayerInvalidDataException("Unknown Success: $value") - } + fun value(): Value = + when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } fun asString(): String = _value().asStringOrThrow() } 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 1f3e874..e82d5a1 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 @@ -2,50 +2,27 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class InferencePipelineTestResultListParams constructor( - private val inferencePipelineId: String, - private val page: Long?, - private val perPage: Long?, - private val status: Status?, - private val type: Type?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class InferencePipelineTestResultListParams +constructor( + private val inferencePipelineId: String, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId @@ -60,31 +37,22 @@ class InferencePipelineTestResultListParams constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.page?.let { - params.put("page", listOf(it.toString())) - } - this.perPage?.let { - params.put("perPage", listOf(it.toString())) - } - this.status?.let { - params.put("status", listOf(it.toString())) - } - this.type?.let { - params.put("type", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.status?.let { params.put("status", listOf(it.toString())) } + this.type?.let { params.put("type", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -94,42 +62,42 @@ class InferencePipelineTestResultListParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListParams && - this.inferencePipelineId == other.inferencePipelineId && - this.page == other.page && - this.perPage == other.perPage && - this.status == other.status && - this.type == other.type && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListParams && + this.inferencePipelineId == other.inferencePipelineId && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -145,7 +113,9 @@ class InferencePipelineTestResultListParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineTestResultListParams: InferencePipelineTestResultListParams) = apply { + internal fun from( + inferencePipelineTestResultListParams: InferencePipelineTestResultListParams + ) = apply { this.inferencePipelineId = inferencePipelineTestResultListParams.inferencePipelineId this.page = inferencePipelineTestResultListParams.page this.perPage = inferencePipelineTestResultListParams.perPage @@ -161,30 +131,22 @@ class InferencePipelineTestResultListParams 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 } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { - this.perPage = perPage - } + fun perPage(perPage: Long) = apply { this.perPage = perPage } /** - * Filter list of test results by status. Available statuses are `running`, - * `passing`, `failing`, `skipped`, and `error`. + * 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: Status) = apply { this.status = status } /** * 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: Type) = apply { this.type = type } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -224,9 +186,7 @@ class InferencePipelineTestResultListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -237,36 +197,40 @@ class InferencePipelineTestResultListParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): InferencePipelineTestResultListParams = InferencePipelineTestResultListParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - page, - perPage, - status, - type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineTestResultListParams = + InferencePipelineTestResultListParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -305,39 +269,43 @@ class InferencePipelineTestResultListParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - fun known(): Known = when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } - class Type @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Type && - this.value == other.value + return other is Type && this.value == other.value } override fun hashCode() = value.hashCode() @@ -376,23 +344,25 @@ class InferencePipelineTestResultListParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - INTEGRITY -> Value.INTEGRITY - CONSISTENCY -> Value.CONSISTENCY - PERFORMANCE -> Value.PERFORMANCE - FAIRNESS -> Value.FAIRNESS - ROBUSTNESS -> Value.ROBUSTNESS - else -> Value._UNKNOWN - } - - 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") - } + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 7135f01..045ce71 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 @@ -5,37 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize 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 java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toUnmodifiable 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 private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { +class InferencePipelineTestResultListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +45,9 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +55,43 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): InferencePipelineTestResultListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -104,7 +101,9 @@ class InferencePipelineTestResultListResponse private constructor(private val _m private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse) = apply { + internal fun from( + inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse + ) = apply { this._meta = inferencePipelineTestResultListResponse._meta this.items = inferencePipelineTestResultListResponse.items additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) @@ -114,17 +113,13 @@ class InferencePipelineTestResultListResponse private constructor(private val _m @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } 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 } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +135,23 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineTestResultListResponse = + InferencePipelineTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -175,24 +171,16 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +188,49 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +256,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +264,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +272,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +280,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,32 +296,33 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item 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, - + class Item + 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, ) { private var validated: Boolean = false @@ -356,10 +338,12 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) /** The project version (commit) id. */ - fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -368,35 +352,30 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The data start date. */ - fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) /** The data end date. */ - fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) /** The status of the test. */ fun status(): Status = status.getRequired("status") /** The status message. */ - fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** Project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("goal") - @ExcludeMissing - fun _goal() = goal + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun _goalId() = goalId + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun _projectVersionId() = projectVersionId + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -404,34 +383,22 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun _inferencePipelineId() = inferencePipelineId /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun _dateDataStarts() = dateDataStarts + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun _dateDataEnds() = dateDataEnds + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds /** The status of the test. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage @JsonAnyGetter @ExcludeMissing @@ -439,69 +406,70 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): Item = apply { if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -541,17 +509,13 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** Project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + 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 - } + fun goal(goal: JsonField) = apply { this.goal = goal } /** The test id. */ fun goalId(goalId: String) = goalId(JsonField.of(goalId)) @@ -559,12 +523,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test id. */ @JsonProperty("goalId") @ExcludeMissing - fun goalId(goalId: JsonField) = apply { - this.goalId = goalId - } + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = projectVersionId(JsonField.of(projectVersionId)) + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) /** The project version (commit) id. */ @JsonProperty("projectVersionId") @@ -574,7 +537,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = inferencePipelineId(JsonField.of(inferencePipelineId)) + fun inferencePipelineId(inferencePipelineId: String) = + inferencePipelineId(JsonField.of(inferencePipelineId)) /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -604,7 +568,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = dateDataStarts(JsonField.of(dateDataStarts)) + fun dateDataStarts(dateDataStarts: OffsetDateTime) = + dateDataStarts(JsonField.of(dateDataStarts)) /** The data start date. */ @JsonProperty("dateDataStarts") @@ -614,7 +579,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = dateDataEnds(JsonField.of(dateDataEnds)) + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) /** The data end date. */ @JsonProperty("dateDataEnds") @@ -629,9 +595,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The status of the test. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + fun status(status: JsonField) = apply { this.status = status } /** The status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -657,34 +621,37 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = + Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -723,54 +690,56 @@ class InferencePipelineTestResultListResponse private constructor(private val _m _UNKNOWN, } - fun value(): Value = when (this) { - RUNNING -> Value.RUNNING - PASSING -> Value.PASSING - FAILING -> Value.FAILING - SKIPPED -> Value.SKIPPED - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - RUNNING -> Known.RUNNING - PASSING -> Known.PASSING - FAILING -> Known.FAILING - SKIPPED -> Known.SKIPPED - ERROR -> Known.ERROR - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = Goal.Builder::class) @NoAutoDetect - class Goal 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, - + class Goal + 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, ) { private var validated: Boolean = false @@ -792,14 +761,13 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** 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 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")) + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) /** The test type. */ fun type(): String = type.getRequired("type") @@ -808,18 +776,22 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun subtype(): String = subtype.getRequired("subtype") /** The test creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + fun originProjectVersionId(): Optional = + Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) fun thresholds(): List = thresholds.getRequired("thresholds") /** Whether the test is archived. */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = + Optional.ofNullable(archived.getNullable("archived")) /** The date the test was archived. */ - fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** Whether the test is suggested or user-created. */ fun suggested(): Boolean = suggested.getRequired("suggested") @@ -828,111 +800,81 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun commentCount(): Long = commentCount.getRequired("commentCount") /** Whether the test uses an ML model. */ - fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = + Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + fun usesTrainingDataset(): Optional = + Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(): Optional = Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + 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")) + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** The test id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The test number. */ - @JsonProperty("number") - @ExcludeMissing - fun _number() = number + @JsonProperty("number") @ExcludeMissing fun _number() = number /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The test description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description - /** - * 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. */ @JsonProperty("evaluationWindow") @ExcludeMissing fun _evaluationWindow() = evaluationWindow /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") - @ExcludeMissing - fun _delayWindow() = delayWindow + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun _type() = type + @JsonProperty("type") @ExcludeMissing fun _type() = type /** The test subtype. */ - @JsonProperty("subtype") - @ExcludeMissing - fun _subtype() = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype /** The test creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @ExcludeMissing fun _originProjectVersionId() = originProjectVersionId - @JsonProperty("thresholds") - @ExcludeMissing - fun _thresholds() = thresholds + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds /** Whether the test is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived /** The date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun _suggested() = suggested + @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun _commentCount() = commentCount + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") - @ExcludeMissing - fun _usesMlModel() = usesMlModel + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -960,101 +902,102 @@ class InferencePipelineTestResultListResponse private constructor(private val _m 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 + 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 } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = 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, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + 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, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1116,9 +1059,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) @@ -1126,9 +1067,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test number. */ @JsonProperty("number") @ExcludeMissing - fun number(number: JsonField) = apply { - this.number = number - } + fun number(number: JsonField) = apply { this.number = number } /** The test name. */ fun name(name: String) = name(JsonField.of(name)) @@ -1136,12 +1075,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) /** The creation date. */ @JsonProperty("dateCreated") @@ -1151,7 +1089,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ @JsonProperty("dateUpdated") @@ -1163,19 +1102,16 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonValue) = apply { - this.description = description - } + fun description(description: JsonValue) = apply { this.description = description } /** - * 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. */ - fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(JsonField.of(evaluationWindow)) + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(JsonField.of(evaluationWindow)) /** - * 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. */ @JsonProperty("evaluationWindow") @ExcludeMissing @@ -1199,9 +1135,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test type. */ @JsonProperty("type") @ExcludeMissing - fun type(type: JsonField) = apply { - this.type = type - } + fun type(type: JsonField) = apply { this.type = type } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) @@ -1209,9 +1143,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test subtype. */ @JsonProperty("subtype") @ExcludeMissing - fun subtype(subtype: JsonField) = apply { - this.subtype = subtype - } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The test creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -1219,12 +1151,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + 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)) + fun originProjectVersionId(originProjectVersionId: String) = + originProjectVersionId(JsonField.of(originProjectVersionId)) /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @@ -1247,12 +1178,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** Whether the test is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { - this.archived = archived - } + fun archived(archived: JsonField) = apply { this.archived = archived } /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) /** The date the test was archived. */ @JsonProperty("dateArchived") @@ -1267,9 +1197,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** Whether the test is suggested or user-created. */ @JsonProperty("suggested") @ExcludeMissing - fun suggested(suggested: JsonField) = apply { - this.suggested = suggested - } + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) @@ -1292,7 +1220,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -1302,7 +1231,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) /** Whether the test uses a training dataset. */ @JsonProperty("usesTrainingDataset") @@ -1312,7 +1242,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @@ -1322,7 +1253,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) /** Whether the test uses production data (monitoring mode only). */ @JsonProperty("usesProductionData") @@ -1341,47 +1273,49 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Goal = Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties.toUnmodifiable(), - ) + fun build(): Goal = + Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Threshold.Builder::class) @NoAutoDetect - class Threshold 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, - + class Threshold + 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, ) { private var validated: Boolean = false @@ -1389,42 +1323,38 @@ class InferencePipelineTestResultListResponse private constructor(private val _m private var hashCode: Int = 0 /** The measurement to be evaluated. */ - fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) /** The insight name to be evaluated. */ - fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = + Optional.ofNullable(insightName.getNullable("insightName")) - fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) /** The operator to be used for the evaluation. */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = + Optional.ofNullable(operator.getNullable("operator")) /** The value to be compared. */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) /** The measurement to be evaluated. */ - @JsonProperty("measurement") - @ExcludeMissing - fun _measurement() = measurement + @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement /** The insight name to be evaluated. */ - @JsonProperty("insightName") - @ExcludeMissing - fun _insightName() = insightName + @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName @JsonProperty("insightParameters") @ExcludeMissing fun _insightParameters() = insightParameters /** The operator to be used for the evaluation. */ - @JsonProperty("operator") - @ExcludeMissing - fun _operator() = operator + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator /** The value to be compared. */ - @JsonProperty("value") - @ExcludeMissing - fun _value() = value + @JsonProperty("value") @ExcludeMissing fun _value() = value @JsonAnyGetter @ExcludeMissing @@ -1432,51 +1362,52 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): Threshold = apply { if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + measurement() + insightName() + insightParameters() + operator() + value() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1518,7 +1449,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.insightName = insightName } - fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) @JsonProperty("insightParameters") @ExcludeMissing @@ -1532,9 +1464,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The operator to be used for the evaluation. */ @JsonProperty("operator") @ExcludeMissing - fun operator(operator: JsonField) = apply { - this.operator = operator - } + fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -1542,9 +1472,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The value to be compared. */ @JsonProperty("value") @ExcludeMissing - fun value(value: JsonField) = apply { - this.value = value - } + fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1556,114 +1484,126 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Threshold = Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) + fun build(): Threshold = + Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) - class Value private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, - private val string: String? = null, - private val strings: List? = null, - private val _json: JsonValue? = null, - + class Value + private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, ) { private var validated: Boolean = false fun double(): Optional = Optional.ofNullable(double) + fun boolean(): Optional = Optional.ofNullable(boolean) + fun string(): Optional = Optional.ofNullable(string) + fun strings(): Optional> = Optional.ofNullable(strings) fun isDouble(): Boolean = double != null + fun isBoolean(): Boolean = boolean != null + fun isString(): Boolean = string != null + fun isStrings(): Boolean = strings != null fun asDouble(): Double = double.getOrThrow("double") + fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + fun asString(): String = string.getOrThrow("string") + fun asStrings(): List = strings.getOrThrow("strings") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { - return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) - string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - else -> visitor.unknown(_json) - } + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } } fun validate(): Value = apply { if (!validated) { - if (double == null && boolean == null && string == null && strings == null) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true + if ( + double == null && + boolean == null && + string == null && + strings == null + ) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true } } override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings } override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) + return Objects.hash( + double, + boolean, + string, + strings, + ) } override fun toString(): String { - return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" - string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } } companion object { - @JvmStatic - fun ofDouble(double: Double) = Value(double = double) + @JvmStatic fun ofDouble(double: Double) = Value(double = double) - @JvmStatic - fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - @JvmStatic - fun ofString(string: String) = Value(string = string) + @JvmStatic fun ofString(string: String) = Value(string = string) - @JvmStatic - fun ofStrings(strings: List) = Value(strings = strings) + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) } interface Visitor { @@ -1677,42 +1617,46 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") + throw OpenlayerInvalidDataException("Unknown Value: $json") } } class Deserializer : BaseDeserializer(Value::class) { override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) } } class Serializer : BaseSerializer(Value::class) { - override fun serialize(value: Value, generator: JsonGenerator, provider: SerializerProvider) { - when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) - 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 serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + 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") + } } } } 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 011a534..9266137 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 @@ -2,48 +2,21 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class ProjectCommitListParams constructor( - private val projectId: String, - private val page: Long?, - private val perPage: Long?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectCommitListParams +constructor( + private val projectId: String, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun projectId(): String = projectId @@ -54,25 +27,20 @@ class ProjectCommitListParams constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.page?.let { - params.put("page", listOf(it.toString())) - } - this.perPage?.let { - params.put("perPage", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -82,38 +50,38 @@ class ProjectCommitListParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListParams && - this.projectId == other.projectId && - this.page == other.page && - this.perPage == other.perPage && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectCommitListParams && + this.projectId == other.projectId && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectId, - page, - perPage, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectId, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -136,19 +104,13 @@ class ProjectCommitListParams constructor( additionalBodyProperties(projectCommitListParams.additionalBodyProperties) } - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + 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 } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { - this.perPage = perPage - } + fun perPage(perPage: Long) = apply { this.perPage = perPage } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -188,9 +150,7 @@ class ProjectCommitListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -201,19 +161,19 @@ class ProjectCommitListParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectCommitListParams = ProjectCommitListParams( - checkNotNull(projectId) { - "`projectId` is required but was not set" - }, - page, - perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectCommitListParams = + ProjectCommitListParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } 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 482f11f..da9d1fd 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 @@ -5,37 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable 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 private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { +class ProjectCommitListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +36,9 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +46,43 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): ProjectCommitListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectCommitListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -114,17 +102,13 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } 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 } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +124,23 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCommitListResponse = ProjectCommitListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCommitListResponse = + ProjectCommitListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -175,24 +160,16 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +177,49 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +245,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +253,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +261,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +269,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,38 +285,39 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item 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, - + class Item + 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, ) { private var validated: Boolean = false @@ -360,13 +331,14 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** - * The commit status. Initially, the commit is `queued`, then, it switches to - * `running`. Finally, it can be `paused`, `failed`, or `completed`. + * 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")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** The project id. */ fun projectId(): String = projectId.getRequired("projectId") @@ -378,22 +350,26 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun commit(): Commit = commit.getRequired("commit") /** The deployment status associated with the commit's model. */ - fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun deploymentStatus(): Optional = + Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) /** The model id. */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) /** The validation dataset id. */ - fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The training dataset id. */ - fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) /** Whether the commit is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) /** The commit archive date. */ - fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** The number of tests that are passing for the commit. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -407,52 +383,34 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun links(): Optional = Optional.ofNullable(links.getNullable("links")) /** The project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** - * The commit status. Initially, the commit is `queued`, then, it switches to - * `running`. Finally, it can be `paused`, `failed`, or `completed`. + * 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() = status /** The commit status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri /** The details of a commit (project version). */ - @JsonProperty("commit") - @ExcludeMissing - fun _commit() = commit + @JsonProperty("commit") @ExcludeMissing fun _commit() = commit /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - @ExcludeMissing - fun _deploymentStatus() = deploymentStatus + @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus() = deploymentStatus /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -465,33 +423,21 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun _trainingDatasetId() = trainingDatasetId /** Whether the commit is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived /** The commit archive date. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -499,87 +445,88 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField 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 + id() + dateCreated() + status() + statusMessage() + projectId() + storageUri() + commit().validate() + deploymentStatus() + mlModelId() + validationDatasetId() + trainingDatasetId() + archived() + dateArchived() + passingGoalCount() + failingGoalCount() + totalGoalCount() + links().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.dateCreated == other.dateCreated && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.projectId == other.projectId && - this.storageUri == other.storageUri && - this.commit == other.commit && - this.deploymentStatus == other.deploymentStatus && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.links == other.links && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.dateCreated == other.dateCreated && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.projectId == other.projectId && + this.storageUri == other.storageUri && + this.commit == other.commit && + this.deploymentStatus == other.deploymentStatus && + this.mlModelId == other.mlModelId && + this.validationDatasetId == other.validationDatasetId && + this.trainingDatasetId == other.trainingDatasetId && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.links == other.links && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -631,9 +578,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** 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 project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -646,20 +591,18 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** - * The commit status. Initially, the commit is `queued`, then, it switches to - * `running`. Finally, it can be `paused`, `failed`, or `completed`. + * 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`. + * 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 - } + fun status(status: JsonField) = apply { this.status = status } /** The commit status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -677,9 +620,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + 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)) @@ -687,9 +628,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The storage URI where the commit bundle is stored. */ @JsonProperty("storageUri") @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { - this.storageUri = storageUri - } + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) @@ -697,12 +636,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The details of a commit (project version). */ @JsonProperty("commit") @ExcludeMissing - fun commit(commit: JsonField) = apply { - this.commit = commit - } + fun commit(commit: JsonField) = apply { this.commit = commit } /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = deploymentStatus(JsonField.of(deploymentStatus)) + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) /** The deployment status associated with the commit's model. */ @JsonProperty("deploymentStatus") @@ -717,12 +655,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The model id. */ @JsonProperty("mlModelId") @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { - this.mlModelId = mlModelId - } + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: String) = + validationDatasetId(JsonField.of(validationDatasetId)) /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -732,7 +669,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String) = + trainingDatasetId(JsonField.of(trainingDatasetId)) /** The training dataset id. */ @JsonProperty("trainingDatasetId") @@ -747,12 +685,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** Whether the commit is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { - this.archived = archived - } + fun archived(archived: JsonField) = apply { this.archived = archived } /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) /** The commit archive date. */ @JsonProperty("dateArchived") @@ -762,7 +699,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests that are passing for the commit. */ @JsonProperty("passingGoalCount") @@ -772,7 +710,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests that are failing for the commit. */ @JsonProperty("failingGoalCount") @@ -795,9 +734,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -813,46 +750,47 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = + Item( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties.toUnmodifiable(), + ) } /** The details of a commit (project version). */ @JsonDeserialize(builder = Commit.Builder::class) @NoAutoDetect - class Commit 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, - + class Commit + 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, ) { private var validated: Boolean = false @@ -866,7 +804,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun authorId(): String = authorId.getRequired("authorId") /** The commit creation date. */ - fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = + Optional.ofNullable(dateCreated.getNullable("dateCreated")) /** The size of the commit bundle in bytes. */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) @@ -875,55 +814,49 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun message(): String = message.getRequired("message") /** The model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = + Optional.ofNullable(mlModelId.getNullable("mlModelId")) /** The validation dataset id. */ - fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The training dataset id. */ - fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) /** The storage URI where the commit bundle is stored. */ fun storageUri(): String = storageUri.getRequired("storageUri") /** The SHA of the corresponding git commit. */ - fun gitCommitSha(): Optional = Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) /** The ref of the corresponding git commit. */ - fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = + Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) /** The URL of the corresponding git commit. */ - fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = + Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) /** The commit id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The author id of the commit. */ - @JsonProperty("authorId") - @ExcludeMissing - fun _authorId() = authorId + @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId /** The commit creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - @ExcludeMissing - fun _fileSize() = fileSize + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize /** The commit message. */ - @JsonProperty("message") - @ExcludeMissing - fun _message() = message + @JsonProperty("message") @ExcludeMissing fun _message() = message /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -936,24 +869,16 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun _trainingDatasetId() = trainingDatasetId /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - @ExcludeMissing - fun _gitCommitSha() = gitCommitSha + @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - @ExcludeMissing - fun _gitCommitRef() = gitCommitRef + @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - @ExcludeMissing - fun _gitCommitUrl() = gitCommitUrl + @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl @JsonAnyGetter @ExcludeMissing @@ -961,72 +886,73 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): Commit = apply { if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true + id() + authorId() + dateCreated() + fileSize() + message() + mlModelId() + validationDatasetId() + trainingDatasetId() + storageUri() + gitCommitSha() + gitCommitRef() + gitCommitUrl() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Commit && - this.id == other.id && - this.authorId == other.authorId && - this.dateCreated == other.dateCreated && - this.fileSize == other.fileSize && - this.message == other.message && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.storageUri == other.storageUri && - this.gitCommitSha == other.gitCommitSha && - this.gitCommitRef == other.gitCommitRef && - this.gitCommitUrl == other.gitCommitUrl && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Commit && + this.id == other.id && + this.authorId == other.authorId && + this.dateCreated == other.dateCreated && + this.fileSize == other.fileSize && + this.message == other.message && + this.mlModelId == other.mlModelId && + this.validationDatasetId == other.validationDatasetId && + this.trainingDatasetId == other.trainingDatasetId && + this.storageUri == other.storageUri && + this.gitCommitSha == other.gitCommitSha && + this.gitCommitRef == other.gitCommitRef && + this.gitCommitUrl == other.gitCommitUrl && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1068,9 +994,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The commit id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) @@ -1078,12 +1002,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The author id of the commit. */ @JsonProperty("authorId") @ExcludeMissing - fun authorId(authorId: JsonField) = apply { - this.authorId = authorId - } + fun authorId(authorId: JsonField) = apply { this.authorId = authorId } /** The commit creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) /** The commit creation date. */ @JsonProperty("dateCreated") @@ -1098,9 +1021,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The size of the commit bundle in bytes. */ @JsonProperty("fileSize") @ExcludeMissing - fun fileSize(fileSize: JsonField) = apply { - this.fileSize = fileSize - } + fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) @@ -1108,9 +1029,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The commit message. */ @JsonProperty("message") @ExcludeMissing - fun message(message: JsonField) = apply { - this.message = message - } + fun message(message: JsonField) = apply { this.message = message } /** The model id. */ fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) @@ -1118,12 +1037,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The model id. */ @JsonProperty("mlModelId") @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { - this.mlModelId = mlModelId - } + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: String) = + validationDatasetId(JsonField.of(validationDatasetId)) /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -1133,7 +1051,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String) = + trainingDatasetId(JsonField.of(trainingDatasetId)) /** The training dataset id. */ @JsonProperty("trainingDatasetId") @@ -1192,40 +1111,44 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Commit = Commit( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties.toUnmodifiable(), - ) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Commit = + Commit( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties.toUnmodifiable(), + ) } } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -1268,32 +1191,38 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -1301,9 +1230,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -1311,36 +1238,35 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1358,9 +1284,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1372,9 +1296,10 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } 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 c4e23aa..559574f 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 @@ -5,45 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional -class ProjectCreateParams constructor( - private val name: String, - private val taskType: TaskType, - private val description: String?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectCreateParams +constructor( + private val name: String, + private val taskType: TaskType, + private val description: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun name(): String = name @@ -54,43 +37,38 @@ class ProjectCreateParams constructor( @JvmSynthetic internal fun getBody(): ProjectCreateBody { - return ProjectCreateBody( - name, - taskType, - description, - additionalBodyProperties, - ) + return ProjectCreateBody( + name, + taskType, + description, + additionalBodyProperties, + ) } - @JvmSynthetic - internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @JsonDeserialize(builder = ProjectCreateBody.Builder::class) @NoAutoDetect - class ProjectCreateBody internal constructor( - private val name: String?, - private val taskType: TaskType?, - private val description: String?, - private val additionalProperties: Map, - + class ProjectCreateBody + internal constructor( + private val name: String?, + private val taskType: TaskType?, + private val description: String?, + private val additionalProperties: Map, ) { private var hashCode: Int = 0 /** The project name. */ - @JsonProperty("name") - fun name(): String? = name + @JsonProperty("name") fun name(): String? = name /** The task type of the project. */ - @JsonProperty("taskType") - fun taskType(): TaskType? = taskType + @JsonProperty("taskType") fun taskType(): TaskType? = taskType /** The project description. */ - @JsonProperty("description") - fun description(): String? = description + @JsonProperty("description") fun description(): String? = description @JsonAnyGetter @ExcludeMissing @@ -99,35 +77,36 @@ class ProjectCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is ProjectCreateBody && - this.name == other.name && - this.taskType == other.taskType && - this.description == other.description && - this.additionalProperties == other.additionalProperties + return other is ProjectCreateBody && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - name, - taskType, - description, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + taskType, + description, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -146,22 +125,15 @@ class ProjectCreateParams constructor( } /** The project name. */ - @JsonProperty("name") - fun name(name: String) = apply { - this.name = name - } + @JsonProperty("name") fun name(name: String) = apply { this.name = name } /** The task type of the project. */ @JsonProperty("taskType") - fun taskType(taskType: TaskType) = apply { - this.taskType = taskType - } + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } /** The project description. */ @JsonProperty("description") - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -177,16 +149,13 @@ class ProjectCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCreateBody = ProjectCreateBody( - checkNotNull(name) { - "`name` is required but was not set" - }, - checkNotNull(taskType) { - "`taskType` is required but was not set" - }, - description, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateBody = + ProjectCreateBody( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(taskType) { "`taskType` is required but was not set" }, + description, + additionalProperties.toUnmodifiable(), + ) } } @@ -197,38 +166,38 @@ class ProjectCreateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCreateParams && - this.name == other.name && - this.taskType == other.taskType && - this.description == other.description && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectCreateParams && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - name, - taskType, - description, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + name, + taskType, + description, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -252,19 +221,13 @@ class ProjectCreateParams constructor( } /** The project name. */ - fun name(name: String) = apply { - this.name = name - } + fun name(name: String) = apply { this.name = name } /** The task type of the project. */ - fun taskType(taskType: TaskType) = apply { - this.taskType = taskType - } + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } /** The project description. */ - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -304,9 +267,7 @@ class ProjectCreateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -317,33 +278,34 @@ class ProjectCreateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): ProjectCreateParams = ProjectCreateParams( - checkNotNull(name) { - "`name` is required but was not set" - }, - checkNotNull(taskType) { - "`taskType` is required but was not set" - }, - description, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateParams = + ProjectCreateParams( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(taskType) { "`taskType` is required but was not set" }, + description, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: String?, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - @JsonProperty("app") - fun app(): String? = app + @JsonProperty("app") fun app(): String? = app @JsonAnyGetter @ExcludeMissing @@ -352,28 +314,27 @@ class ProjectCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -387,10 +348,7 @@ class ProjectCreateParams constructor( additionalProperties(links.additionalProperties) } - @JsonProperty("app") - fun app(app: String) = apply { - this.app = app - } + @JsonProperty("app") fun app(app: String) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -406,24 +364,28 @@ class ProjectCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(checkNotNull(app) { - "`app` is required but was not set" - }, additionalProperties.toUnmodifiable()) + fun build(): Links = + Links( + checkNotNull(app) { "`app` is required but was not set" }, + additionalProperties.toUnmodifiable() + ) } } - class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && - this.value == other.value + return other is Source && this.value == other.value } override fun hashCode() = value.hashCode() @@ -454,35 +416,39 @@ class ProjectCreateParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -517,81 +483,71 @@ class ProjectCreateParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo 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, - + class GitRepo + 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, ) { private var hashCode: Int = 0 - @JsonProperty("id") - fun id(): String? = id + @JsonProperty("id") fun id(): String? = id - @JsonProperty("gitId") - fun gitId(): Long? = gitId + @JsonProperty("gitId") fun gitId(): Long? = gitId - @JsonProperty("dateConnected") - fun dateConnected(): OffsetDateTime? = dateConnected + @JsonProperty("dateConnected") fun dateConnected(): OffsetDateTime? = dateConnected - @JsonProperty("dateUpdated") - fun dateUpdated(): OffsetDateTime? = dateUpdated + @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated - @JsonProperty("branch") - fun branch(): String? = branch + @JsonProperty("branch") fun branch(): String? = branch - @JsonProperty("name") - fun name(): String? = name + @JsonProperty("name") fun name(): String? = name - @JsonProperty("private") - fun private_(): Boolean? = private_ + @JsonProperty("private") fun private_(): Boolean? = private_ - @JsonProperty("slug") - fun slug(): String? = slug + @JsonProperty("slug") fun slug(): String? = slug - @JsonProperty("url") - fun url(): String? = url + @JsonProperty("url") fun url(): String? = url - @JsonProperty("rootDir") - fun rootDir(): String? = rootDir + @JsonProperty("rootDir") fun rootDir(): String? = rootDir - @JsonProperty("projectId") - fun projectId(): String? = projectId + @JsonProperty("projectId") fun projectId(): String? = projectId - @JsonProperty("gitAccountId") - fun gitAccountId(): String? = gitAccountId + @JsonProperty("gitAccountId") fun gitAccountId(): String? = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -600,53 +556,54 @@ class ProjectCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -682,15 +639,9 @@ class ProjectCreateParams constructor( additionalProperties(gitRepo.additionalProperties) } - @JsonProperty("id") - fun id(id: String) = apply { - this.id = id - } + @JsonProperty("id") fun id(id: String) = apply { this.id = id } - @JsonProperty("gitId") - fun gitId(gitId: Long) = apply { - this.gitId = gitId - } + @JsonProperty("gitId") fun gitId(gitId: Long) = apply { this.gitId = gitId } @JsonProperty("dateConnected") fun dateConnected(dateConnected: OffsetDateTime) = apply { @@ -698,49 +649,26 @@ class ProjectCreateParams constructor( } @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { - this.dateUpdated = dateUpdated - } + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } - @JsonProperty("branch") - fun branch(branch: String) = apply { - this.branch = branch - } + @JsonProperty("branch") fun branch(branch: String) = apply { this.branch = branch } - @JsonProperty("name") - fun name(name: String) = apply { - this.name = name - } + @JsonProperty("name") fun name(name: String) = apply { this.name = name } @JsonProperty("private") - fun private_(private_: Boolean) = apply { - this.private_ = private_ - } + fun private_(private_: Boolean) = apply { this.private_ = private_ } - @JsonProperty("slug") - fun slug(slug: String) = apply { - this.slug = slug - } + @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } - @JsonProperty("url") - fun url(url: String) = apply { - this.url = url - } + @JsonProperty("url") fun url(url: String) = apply { this.url = url } - @JsonProperty("rootDir") - fun rootDir(rootDir: String) = apply { - this.rootDir = rootDir - } + @JsonProperty("rootDir") fun rootDir(rootDir: String) = apply { this.rootDir = rootDir } @JsonProperty("projectId") - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + fun projectId(projectId: String) = apply { this.projectId = projectId } @JsonProperty("gitAccountId") - fun gitAccountId(gitAccountId: String) = apply { - this.gitAccountId = gitAccountId - } + fun gitAccountId(gitAccountId: String) = apply { this.gitAccountId = gitAccountId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -756,41 +684,22 @@ class ProjectCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - 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" - }, - 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.toUnmodifiable(), - ) + 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" }, + 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.toUnmodifiable(), + ) } } } 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 edc4a49..eb6afee 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 @@ -5,55 +5,41 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable 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 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, - +class ProjectCreateResponse +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, ) { private var validated: Boolean = false @@ -64,7 +50,8 @@ class ProjectCreateResponse private constructor( fun id(): String = id.getRequired("id") /** The workspace id. */ - fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) @@ -79,7 +66,8 @@ class ProjectCreateResponse private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The project description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -91,7 +79,8 @@ class ProjectCreateResponse private constructor( fun versionCount(): Long = versionCount.getRequired("versionCount") /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") /** The total number of tests in the project. */ fun goalCount(): Long = goalCount.getRequired("goalCount") @@ -108,54 +97,34 @@ class ProjectCreateResponse private constructor( fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun _workspaceId() = workspaceId + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing - fun _source() = source + @JsonProperty("source") @ExcludeMissing fun _source() = source /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing - fun _taskType() = taskType + @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing - fun _versionCount() = versionCount + @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -163,9 +132,7 @@ class ProjectCreateResponse private constructor( fun _inferencePipelineCount() = inferencePipelineCount /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun _goalCount() = goalCount + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -178,13 +145,9 @@ class ProjectCreateResponse private constructor( fun _monitoringGoalCount() = monitoringGoalCount /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links - @JsonProperty("gitRepo") - @ExcludeMissing - fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo @JsonAnyGetter @ExcludeMissing @@ -192,84 +155,85 @@ class ProjectCreateResponse private constructor( 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 + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + links().validate() + gitRepo().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCreateResponse && - this.id == other.id && - this.workspaceId == other.workspaceId && - this.creatorId == other.creatorId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.source == other.source && - this.taskType == other.taskType && - this.versionCount == other.versionCount && - this.inferencePipelineCount == other.inferencePipelineCount && - this.goalCount == other.goalCount && - this.developmentGoalCount == other.developmentGoalCount && - this.monitoringGoalCount == other.monitoringGoalCount && - this.links == other.links && - this.gitRepo == other.gitRepo && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectCreateResponse && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.links == other.links && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -317,11 +281,7 @@ class ProjectCreateResponse private constructor( fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) @@ -329,9 +289,7 @@ class ProjectCreateResponse private constructor( /** The workspace id. */ @JsonProperty("workspaceId") @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } /** The project creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -339,9 +297,7 @@ class ProjectCreateResponse private constructor( /** The project creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) @@ -349,9 +305,7 @@ class ProjectCreateResponse private constructor( /** The project name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -379,9 +333,7 @@ class ProjectCreateResponse private constructor( /** The project description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description - } + fun description(description: JsonField) = apply { this.description = description } /** The source of the project. */ fun source(source: Source) = source(JsonField.of(source)) @@ -389,9 +341,7 @@ class ProjectCreateResponse private constructor( /** The source of the project. */ @JsonProperty("source") @ExcludeMissing - fun source(source: JsonField) = apply { - this.source = source - } + fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) @@ -399,9 +349,7 @@ class ProjectCreateResponse private constructor( /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing - fun taskType(taskType: JsonField) = apply { - this.taskType = taskType - } + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) @@ -409,12 +357,11 @@ class ProjectCreateResponse private constructor( /** The number of versions (commits) in the project. */ @JsonProperty("versionCount") @ExcludeMissing - fun versionCount(versionCount: JsonField) = apply { - this.versionCount = versionCount - } + fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -429,12 +376,11 @@ class ProjectCreateResponse private constructor( /** The total number of tests in the project. */ @JsonProperty("goalCount") @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { - this.goalCount = goalCount - } + 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)) + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -444,7 +390,8 @@ class ProjectCreateResponse private constructor( } /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @@ -459,17 +406,13 @@ class ProjectCreateResponse private constructor( /** Links to the project. */ @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @ExcludeMissing - fun gitRepo(gitRepo: JsonField) = apply { - this.gitRepo = gitRepo - } + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -485,31 +428,36 @@ class ProjectCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCreateResponse = ProjectCreateResponse( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateResponse = + ProjectCreateResponse( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -517,9 +465,7 @@ class ProjectCreateResponse private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -527,36 +473,35 @@ class ProjectCreateResponse private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -574,9 +519,7 @@ class ProjectCreateResponse private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -596,18 +539,20 @@ class ProjectCreateResponse private constructor( } } - class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && - this.value == other.value + return other is Source && this.value == other.value } override fun hashCode() = value.hashCode() @@ -638,35 +583,39 @@ class ProjectCreateResponse private constructor( _UNKNOWN, } - fun value(): Value = when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -701,42 +650,44 @@ class ProjectCreateResponse private constructor( _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo 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, - + class GitRepo + 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, ) { private var validated: Boolean = false @@ -767,53 +718,29 @@ class ProjectCreateResponse private constructor( fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("gitId") - @ExcludeMissing - fun _gitId() = gitId + @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId - @JsonProperty("dateConnected") - @ExcludeMissing - fun _dateConnected() = dateConnected + @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - @JsonProperty("branch") - @ExcludeMissing - fun _branch() = branch + @JsonProperty("branch") @ExcludeMissing fun _branch() = branch - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("private") - @ExcludeMissing - fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_() = private_ - @JsonProperty("slug") - @ExcludeMissing - fun _slug() = slug + @JsonProperty("slug") @ExcludeMissing fun _slug() = slug - @JsonProperty("url") - @ExcludeMissing - fun _url() = url + @JsonProperty("url") @ExcludeMissing fun _url() = url - @JsonProperty("rootDir") - @ExcludeMissing - fun _rootDir() = rootDir + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - @JsonProperty("gitAccountId") - @ExcludeMissing - fun _gitAccountId() = gitAccountId + @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -821,72 +748,73 @@ class ProjectCreateResponse private constructor( fun validate(): GitRepo = apply { if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -926,19 +854,16 @@ class ProjectCreateResponse private constructor( @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + 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 gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) @JsonProperty("dateConnected") @ExcludeMissing @@ -958,57 +883,43 @@ class ProjectCreateResponse private constructor( @JsonProperty("branch") @ExcludeMissing - fun branch(branch: JsonField) = apply { - this.branch = branch - } + fun branch(branch: JsonField) = apply { this.branch = branch } fun name(name: String) = name(JsonField.of(name)) @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + 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 private_(private_: JsonField) = apply { this.private_ = private_ } fun slug(slug: String) = slug(JsonField.of(slug)) @JsonProperty("slug") @ExcludeMissing - fun slug(slug: JsonField) = apply { - this.slug = slug - } + 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 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 rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) @@ -1032,21 +943,22 @@ class ProjectCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties.toUnmodifiable(), - ) + fun build(): GitRepo = + GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties.toUnmodifiable(), + ) } } } 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 9b2a6e5..cab7c08 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 @@ -5,45 +5,27 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class ProjectInferencePipelineCreateParams constructor( - private val projectId: String, - private val description: String?, - private val name: String, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectInferencePipelineCreateParams +constructor( + private val projectId: String, + private val description: String?, + private val name: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun projectId(): String = projectId @@ -54,39 +36,40 @@ class ProjectInferencePipelineCreateParams constructor( @JvmSynthetic internal fun getBody(): ProjectInferencePipelineCreateBody { - return ProjectInferencePipelineCreateBody( - description, - name, - additionalBodyProperties, - ) + return ProjectInferencePipelineCreateBody( + description, + name, + additionalBodyProperties, + ) } - @JvmSynthetic - internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } @JsonDeserialize(builder = ProjectInferencePipelineCreateBody.Builder::class) @NoAutoDetect - class ProjectInferencePipelineCreateBody internal constructor(private val description: String?, private val name: String?, private val additionalProperties: Map, ) { + class ProjectInferencePipelineCreateBody + internal constructor( + private val description: String?, + private val name: String?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 /** The inference pipeline description. */ - @JsonProperty("description") - fun description(): String? = description + @JsonProperty("description") fun description(): String? = description /** The inference pipeline name. */ - @JsonProperty("name") - fun name(): String? = name + @JsonProperty("name") fun name(): String? = name @JsonAnyGetter @ExcludeMissing @@ -95,33 +78,34 @@ class ProjectInferencePipelineCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateBody && - this.description == other.description && - this.name == other.name && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateBody && + this.description == other.description && + this.name == other.name && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - description, - name, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + description, + name, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -131,7 +115,9 @@ class ProjectInferencePipelineCreateParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody) = apply { + internal fun from( + projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody + ) = apply { this.description = projectInferencePipelineCreateBody.description this.name = projectInferencePipelineCreateBody.name additionalProperties(projectInferencePipelineCreateBody.additionalProperties) @@ -139,15 +125,10 @@ class ProjectInferencePipelineCreateParams constructor( /** The inference pipeline description. */ @JsonProperty("description") - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } /** The inference pipeline name. */ - @JsonProperty("name") - fun name(name: String) = apply { - this.name = name - } + @JsonProperty("name") fun name(name: String) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -163,13 +144,12 @@ class ProjectInferencePipelineCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineCreateBody = ProjectInferencePipelineCreateBody( - description, - checkNotNull(name) { - "`name` is required but was not set" - }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateBody = + ProjectInferencePipelineCreateBody( + description, + checkNotNull(name) { "`name` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) } } @@ -180,38 +160,38 @@ class ProjectInferencePipelineCreateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateParams && - this.projectId == other.projectId && - this.description == other.description && - this.name == other.name && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateParams && + this.projectId == other.projectId && + this.description == other.description && + this.name == other.name && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectId, - description, - name, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectId, + description, + name, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -225,7 +205,9 @@ class ProjectInferencePipelineCreateParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams) = apply { + internal fun from( + projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams + ) = apply { this.projectId = projectInferencePipelineCreateParams.projectId this.description = projectInferencePipelineCreateParams.description this.name = projectInferencePipelineCreateParams.name @@ -234,19 +216,13 @@ class ProjectInferencePipelineCreateParams constructor( additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) } - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + 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 { this.description = description } /** The inference pipeline name. */ - fun name(name: String) = apply { - this.name = name - } + fun name(name: String) = apply { this.name = name } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -286,9 +262,7 @@ class ProjectInferencePipelineCreateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -299,32 +273,33 @@ class ProjectInferencePipelineCreateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): ProjectInferencePipelineCreateParams = ProjectInferencePipelineCreateParams( - checkNotNull(projectId) { - "`projectId` is required but was not set" - }, - description, - checkNotNull(name) { - "`name` is required but was not set" - }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateParams = + ProjectInferencePipelineCreateParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + description, + checkNotNull(name) { "`name` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: String?, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - @JsonProperty("app") - fun app(): String? = app + @JsonProperty("app") fun app(): String? = app @JsonAnyGetter @ExcludeMissing @@ -333,28 +308,27 @@ class ProjectInferencePipelineCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -368,10 +342,7 @@ class ProjectInferencePipelineCreateParams constructor( additionalProperties(links.additionalProperties) } - @JsonProperty("app") - fun app(app: String) = apply { - this.app = app - } + @JsonProperty("app") fun app(app: String) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -387,24 +358,28 @@ class ProjectInferencePipelineCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(checkNotNull(app) { - "`app` is required but was not set" - }, additionalProperties.toUnmodifiable()) + fun build(): Links = + Links( + checkNotNull(app) { "`app` is required but was not set" }, + additionalProperties.toUnmodifiable() + ) } } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -447,25 +422,27 @@ class ProjectInferencePipelineCreateParams constructor( _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 c6b8166..acd34bb 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 @@ -5,54 +5,40 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional @JsonDeserialize(builder = ProjectInferencePipelineCreateResponse.Builder::class) @NoAutoDetect -class ProjectInferencePipelineCreateResponse private constructor( - private val id: JsonField, - private val projectId: 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, - +class ProjectInferencePipelineCreateResponse +private constructor( + private val id: JsonField, + private val projectId: 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, ) { private var validated: Boolean = false @@ -75,16 +61,20 @@ class ProjectInferencePipelineCreateResponse private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The last data sample received date. */ - fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) /** The inference pipeline description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -99,34 +89,25 @@ class ProjectInferencePipelineCreateResponse private constructor( fun status(): Status = status.getRequired("status") /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) fun links(): Links = links.getRequired("links") /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -134,14 +115,10 @@ class ProjectInferencePipelineCreateResponse private constructor( fun _dateLastSampleReceived() = dateLastSampleReceived /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun _dateLastEvaluated() = dateLastEvaluated + @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -149,33 +126,21 @@ class ProjectInferencePipelineCreateResponse private constructor( fun _dateOfNextEvaluation() = dateOfNextEvaluation /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -183,81 +148,82 @@ class ProjectInferencePipelineCreateResponse private constructor( fun validate(): ProjectInferencePipelineCreateResponse = apply { if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateResponse && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, 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}" + override fun toString() = + "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -280,13 +246,16 @@ class ProjectInferencePipelineCreateResponse private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse) = apply { + internal fun from( + projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse + ) = apply { this.id = projectInferencePipelineCreateResponse.id this.projectId = projectInferencePipelineCreateResponse.projectId this.name = projectInferencePipelineCreateResponse.name this.dateCreated = projectInferencePipelineCreateResponse.dateCreated this.dateUpdated = projectInferencePipelineCreateResponse.dateUpdated - this.dateLastSampleReceived = projectInferencePipelineCreateResponse.dateLastSampleReceived + this.dateLastSampleReceived = + projectInferencePipelineCreateResponse.dateLastSampleReceived this.description = projectInferencePipelineCreateResponse.description this.dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated this.dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation @@ -303,11 +272,7 @@ class ProjectInferencePipelineCreateResponse private constructor( fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @@ -315,9 +280,7 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) @@ -325,9 +288,7 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -350,7 +311,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = + dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -365,12 +327,11 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The inference pipeline description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description - } + fun description(description: JsonField) = apply { this.description = description } /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = dateLastEvaluated(JsonField.of(dateLastEvaluated)) + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = + dateLastEvaluated(JsonField.of(dateLastEvaluated)) /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -380,7 +341,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -390,7 +352,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ @JsonProperty("passingGoalCount") @@ -400,7 +363,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests failing. */ @JsonProperty("failingGoalCount") @@ -425,9 +389,7 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The status of test evaluation for the inference pipeline. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + 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)) @@ -443,9 +405,7 @@ class ProjectInferencePipelineCreateResponse private constructor( @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -461,29 +421,34 @@ class ProjectInferencePipelineCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineCreateResponse = ProjectInferencePipelineCreateResponse( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -491,9 +456,7 @@ class ProjectInferencePipelineCreateResponse private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -501,36 +464,35 @@ class ProjectInferencePipelineCreateResponse private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -548,9 +510,7 @@ class ProjectInferencePipelineCreateResponse private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -570,18 +530,20 @@ class ProjectInferencePipelineCreateResponse private constructor( } } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -624,25 +586,27 @@ class ProjectInferencePipelineCreateResponse private constructor( _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 b5ed45c..1b909ab 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 @@ -2,49 +2,22 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class ProjectInferencePipelineListParams constructor( - private val projectId: String, - private val name: String?, - private val page: Long?, - private val perPage: Long?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectInferencePipelineListParams +constructor( + private val projectId: String, + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun projectId(): String = projectId @@ -57,28 +30,21 @@ class ProjectInferencePipelineListParams constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.name?.let { - params.put("name", listOf(it.toString())) - } - this.page?.let { - params.put("page", listOf(it.toString())) - } - this.perPage?.let { - params.put("perPage", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.name?.let { params.put("name", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -88,40 +54,40 @@ class ProjectInferencePipelineListParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListParams && - this.projectId == other.projectId && - this.name == other.name && - this.page == other.page && - this.perPage == other.perPage && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListParams && + this.projectId == other.projectId && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - projectId, - name, - page, - perPage, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + projectId, + name, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -136,34 +102,29 @@ class ProjectInferencePipelineListParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = apply { - this.projectId = projectInferencePipelineListParams.projectId - this.name = projectInferencePipelineListParams.name - this.page = projectInferencePipelineListParams.page - this.perPage = projectInferencePipelineListParams.perPage - additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) - additionalHeaders(projectInferencePipelineListParams.additionalHeaders) - additionalBodyProperties(projectInferencePipelineListParams.additionalBodyProperties) - } - - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = + apply { + this.projectId = projectInferencePipelineListParams.projectId + this.name = projectInferencePipelineListParams.name + this.page = projectInferencePipelineListParams.page + this.perPage = projectInferencePipelineListParams.perPage + additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineListParams.additionalHeaders) + additionalBodyProperties( + projectInferencePipelineListParams.additionalBodyProperties + ) + } + + 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 } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { - this.page = page - } + fun page(page: Long) = apply { this.page = page } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { - this.perPage = perPage - } + fun perPage(perPage: Long) = apply { this.perPage = perPage } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -203,9 +164,7 @@ class ProjectInferencePipelineListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -216,20 +175,20 @@ class ProjectInferencePipelineListParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectInferencePipelineListParams = ProjectInferencePipelineListParams( - checkNotNull(projectId) { - "`projectId` is required but was not set" - }, - name, - page, - perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectInferencePipelineListParams = + ProjectInferencePipelineListParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + name, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } 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 5a96dcc..cb9e840 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 @@ -5,37 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional @JsonDeserialize(builder = ProjectInferencePipelineListResponse.Builder::class) @NoAutoDetect -class ProjectInferencePipelineListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { +class ProjectInferencePipelineListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +36,9 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +46,43 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): ProjectInferencePipelineListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -104,7 +92,9 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineListResponse: ProjectInferencePipelineListResponse) = apply { + internal fun from( + projectInferencePipelineListResponse: ProjectInferencePipelineListResponse + ) = apply { this._meta = projectInferencePipelineListResponse._meta this.items = projectInferencePipelineListResponse.items additionalProperties(projectInferencePipelineListResponse.additionalProperties) @@ -114,17 +104,13 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } 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 } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +126,23 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineListResponse = ProjectInferencePipelineListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineListResponse = + ProjectInferencePipelineListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -175,24 +162,16 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +179,49 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +247,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +255,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +263,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +271,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,36 +287,37 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item private constructor( - private val id: JsonField, - private val projectId: 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, - + class Item + private constructor( + private val id: JsonField, + private val projectId: 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, ) { private var validated: Boolean = false @@ -367,16 +340,20 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The last data sample received date. */ - fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) /** The inference pipeline description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -391,34 +368,25 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun status(): Status = status.getRequired("status") /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) fun links(): Links = links.getRequired("links") /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -426,9 +394,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun _dateLastSampleReceived() = dateLastSampleReceived /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -441,33 +407,21 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun _dateOfNextEvaluation() = dateOfNextEvaluation /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -475,81 +429,82 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): Item = apply { if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Item{id=$id, projectId=$projectId, 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}" + override fun toString() = + "Item{id=$id, projectId=$projectId, 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -597,9 +552,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** 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)) @@ -607,9 +560,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) @@ -617,9 +568,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -642,7 +591,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = + dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -662,7 +612,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = dateLastEvaluated(JsonField.of(dateLastEvaluated)) + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = + dateLastEvaluated(JsonField.of(dateLastEvaluated)) /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -672,7 +623,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -682,7 +634,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ @JsonProperty("passingGoalCount") @@ -692,7 +645,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests failing. */ @JsonProperty("failingGoalCount") @@ -717,9 +671,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The status of test evaluation for the inference pipeline. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + 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)) @@ -735,9 +687,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -753,29 +703,34 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = + Item( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -783,9 +738,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -793,36 +746,35 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -840,9 +792,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -854,26 +804,29 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -916,25 +869,27 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta _UNKNOWN, } - 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 - } + 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 + } - 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") - } + 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") + } fun asString(): String = _value().asStringOrThrow() } 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 bd79a95..b493cd2 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 @@ -2,49 +2,26 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class ProjectListParams constructor( - private val name: String?, - private val page: Long?, - private val perPage: Long?, - private val taskType: TaskType?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectListParams +constructor( + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val taskType: TaskType?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun name(): Optional = Optional.ofNullable(name) @@ -57,25 +34,16 @@ class ProjectListParams constructor( @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.name?.let { - params.put("name", listOf(it.toString())) - } - this.page?.let { - params.put("page", listOf(it.toString())) - } - this.perPage?.let { - params.put("perPage", listOf(it.toString())) - } - this.taskType?.let { - params.put("taskType", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.name?.let { params.put("name", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.taskType?.let { params.put("taskType", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams @@ -84,40 +52,40 @@ class ProjectListParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectListParams && - this.name == other.name && - this.page == other.page && - this.perPage == other.perPage && - this.taskType == other.taskType && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectListParams && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.taskType == other.taskType && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - name, - page, - perPage, - taskType, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + name, + page, + perPage, + taskType, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectListParams{name=$name, page=$page, perPage=$perPage, taskType=$taskType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectListParams{name=$name, page=$page, perPage=$perPage, taskType=$taskType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -143,24 +111,16 @@ class ProjectListParams constructor( } /** Filter list of items by project name. */ - fun name(name: String) = apply { - this.name = name - } + fun name(name: String) = apply { this.name = name } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { - this.page = page - } + fun page(page: Long) = apply { this.page = page } /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { - this.perPage = perPage - } + fun perPage(perPage: Long) = apply { this.perPage = perPage } /** Filter list of items by task type. */ - fun taskType(taskType: TaskType) = apply { - this.taskType = taskType - } + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -200,9 +160,7 @@ class ProjectListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -213,33 +171,37 @@ class ProjectListParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectListParams = ProjectListParams( - name, - page, - perPage, - taskType, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectListParams = + ProjectListParams( + name, + page, + perPage, + taskType, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -274,21 +236,23 @@ class ProjectListParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } - - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } 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 f6e8e92..69c6387 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 @@ -5,37 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable 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 private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { +class ProjectListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +36,9 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +46,43 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): ProjectListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _meta().validate() + items().forEach { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - _meta, - items, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -114,17 +102,13 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } 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 } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +124,23 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectListResponse = ProjectListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectListResponse = + ProjectListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = _Meta.Builder::class) @NoAutoDetect - class _Meta private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: Map, - + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -175,24 +160,16 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +177,49 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + page() + perPage() + totalItems() + totalPages() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is _Meta && - this.page == other.page && - this.perPage == other.perPage && - this.totalItems == other.totalItems && - this.totalPages == other.totalPages && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - page, - perPage, - totalItems, - totalPages, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +245,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +253,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +261,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +269,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,37 +285,38 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + fun build(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) } } @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect - class Item 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, - + class Item + 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, ) { private var validated: Boolean = false @@ -356,7 +327,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun id(): String = id.getRequired("id") /** The workspace id. */ - fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) @@ -371,7 +343,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The project description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -383,7 +356,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun versionCount(): Long = versionCount.getRequired("versionCount") /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") /** The total number of tests in the project. */ fun goalCount(): Long = goalCount.getRequired("goalCount") @@ -400,54 +374,34 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun _workspaceId() = workspaceId + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing - fun _source() = source + @JsonProperty("source") @ExcludeMissing fun _source() = source /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing - fun _taskType() = taskType + @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing - fun _versionCount() = versionCount + @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -455,9 +409,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun _inferencePipelineCount() = inferencePipelineCount /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun _goalCount() = goalCount + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -470,13 +422,9 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun _monitoringGoalCount() = monitoringGoalCount /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links - @JsonProperty("gitRepo") - @ExcludeMissing - fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo @JsonAnyGetter @ExcludeMissing @@ -484,84 +432,85 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta 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 + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + links().validate() + gitRepo().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.workspaceId == other.workspaceId && - this.creatorId == other.creatorId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.source == other.source && - this.taskType == other.taskType && - this.versionCount == other.versionCount && - this.inferencePipelineCount == other.inferencePipelineCount && - this.goalCount == other.goalCount && - this.developmentGoalCount == other.developmentGoalCount && - this.monitoringGoalCount == other.monitoringGoalCount && - this.links == other.links && - this.gitRepo == other.gitRepo && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.links == other.links && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -611,9 +560,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The project id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) @@ -631,9 +578,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The project creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) @@ -641,9 +586,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The project name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -681,9 +624,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The source of the project. */ @JsonProperty("source") @ExcludeMissing - fun source(source: JsonField) = apply { - this.source = source - } + fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) @@ -691,9 +632,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing - fun taskType(taskType: JsonField) = apply { - this.taskType = taskType - } + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) @@ -706,7 +645,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta } /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -721,12 +661,11 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The total number of tests in the project. */ @JsonProperty("goalCount") @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { - this.goalCount = goalCount - } + 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)) + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -736,7 +675,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta } /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @@ -751,17 +691,13 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** Links to the project. */ @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @ExcludeMissing - fun gitRepo(gitRepo: JsonField) = apply { - this.gitRepo = gitRepo - } + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -777,31 +713,36 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = + Item( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -809,9 +750,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -819,36 +758,35 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -866,9 +804,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -880,26 +816,29 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } } - class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && - this.value == other.value + return other is Source && this.value == other.value } override fun hashCode() = value.hashCode() @@ -930,35 +869,39 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta _UNKNOWN, } - fun value(): Value = when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -969,7 +912,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JvmField val LLM_BASE = TaskType(JsonField.of("llm-base")) - @JvmField val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) + @JvmField + val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) @JvmField val TABULAR_REGRESSION = TaskType(JsonField.of("tabular-regression")) @@ -993,42 +937,44 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo 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, - + class GitRepo + 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, ) { private var validated: Boolean = false @@ -1059,53 +1005,29 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("gitId") - @ExcludeMissing - fun _gitId() = gitId + @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId - @JsonProperty("dateConnected") - @ExcludeMissing - fun _dateConnected() = dateConnected + @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - @JsonProperty("branch") - @ExcludeMissing - fun _branch() = branch + @JsonProperty("branch") @ExcludeMissing fun _branch() = branch - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("private") - @ExcludeMissing - fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_() = private_ - @JsonProperty("slug") - @ExcludeMissing - fun _slug() = slug + @JsonProperty("slug") @ExcludeMissing fun _slug() = slug - @JsonProperty("url") - @ExcludeMissing - fun _url() = url + @JsonProperty("url") @ExcludeMissing fun _url() = url - @JsonProperty("rootDir") - @ExcludeMissing - fun _rootDir() = rootDir + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - @JsonProperty("gitAccountId") - @ExcludeMissing - fun _gitAccountId() = gitAccountId + @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -1113,72 +1035,73 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): GitRepo = apply { if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return 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}" + 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}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1218,19 +1141,16 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + 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 gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) @JsonProperty("dateConnected") @ExcludeMissing @@ -1238,7 +1158,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.dateConnected = dateConnected } - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) @JsonProperty("dateUpdated") @ExcludeMissing @@ -1250,57 +1171,43 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("branch") @ExcludeMissing - fun branch(branch: JsonField) = apply { - this.branch = branch - } + fun branch(branch: JsonField) = apply { this.branch = branch } fun name(name: String) = name(JsonField.of(name)) @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + 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 private_(private_: JsonField) = apply { this.private_ = private_ } fun slug(slug: String) = slug(JsonField.of(slug)) @JsonProperty("slug") @ExcludeMissing - fun slug(slug: JsonField) = apply { - this.slug = slug - } + 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 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 rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) @@ -1320,25 +1227,27 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties.toUnmodifiable(), - ) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GitRepo = + GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties.toUnmodifiable(), + ) } } } 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 86d7d09..e5085a5 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 @@ -2,67 +2,37 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class StoragePresignedUrlCreateParams constructor( - private val objectName: String, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class StoragePresignedUrlCreateParams +constructor( + private val objectName: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun objectName(): String = objectName @JvmSynthetic internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.objectName.let { - params.put("objectName", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.objectName.let { params.put("objectName", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams @@ -71,34 +41,34 @@ class StoragePresignedUrlCreateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StoragePresignedUrlCreateParams && - this.objectName == other.objectName && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateParams && + this.objectName == other.objectName && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - objectName, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + objectName, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -110,17 +80,16 @@ class StoragePresignedUrlCreateParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = apply { - this.objectName = storagePresignedUrlCreateParams.objectName - additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) - additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) - additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) - } + internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = + apply { + this.objectName = storagePresignedUrlCreateParams.objectName + additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) + additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) + additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) + } /** The name of the object. */ - fun objectName(objectName: String) = apply { - this.objectName = objectName - } + fun objectName(objectName: String) = apply { this.objectName = objectName } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -160,9 +129,7 @@ class StoragePresignedUrlCreateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -173,17 +140,17 @@ class StoragePresignedUrlCreateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): StoragePresignedUrlCreateParams = StoragePresignedUrlCreateParams( - checkNotNull(objectName) { - "`objectName` is required but was not set" - }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): StoragePresignedUrlCreateParams = + StoragePresignedUrlCreateParams( + checkNotNull(objectName) { "`objectName` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } 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 cdccfb8..57c2fca 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,43 +4,24 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow 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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable +import java.util.Objects @JsonDeserialize(builder = StoragePresignedUrlCreateResponse.Builder::class) @NoAutoDetect -class StoragePresignedUrlCreateResponse private constructor( - private val url: JsonField, - private val fields: JsonValue, - private val storageUri: JsonField, - private val additionalProperties: Map, - +class StoragePresignedUrlCreateResponse +private constructor( + private val url: JsonField, + private val fields: JsonValue, + private val storageUri: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -54,19 +35,13 @@ class StoragePresignedUrlCreateResponse private constructor( fun storageUri(): String = storageUri.getRequired("storageUri") /** The presigned url. */ - @JsonProperty("url") - @ExcludeMissing - fun _url() = url + @JsonProperty("url") @ExcludeMissing fun _url() = 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() = 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() = storageUri @JsonAnyGetter @ExcludeMissing @@ -74,44 +49,45 @@ class StoragePresignedUrlCreateResponse private constructor( fun validate(): StoragePresignedUrlCreateResponse = apply { if (!validated) { - url() - storageUri() - validated = true + url() + storageUri() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StoragePresignedUrlCreateResponse && - this.url == other.url && - this.fields == other.fields && - this.storageUri == other.storageUri && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateResponse && + this.url == other.url && + this.fields == other.fields && + this.storageUri == other.storageUri && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - url, - fields, - storageUri, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + url, + fields, + storageUri, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" + override fun toString() = + "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -122,12 +98,13 @@ class StoragePresignedUrlCreateResponse private constructor( 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) - } + internal fun from(storagePresignedUrlCreateResponse: StoragePresignedUrlCreateResponse) = + apply { + this.url = storagePresignedUrlCreateResponse.url + this.fields = storagePresignedUrlCreateResponse.fields + this.storageUri = storagePresignedUrlCreateResponse.storageUri + additionalProperties(storagePresignedUrlCreateResponse.additionalProperties) + } /** The presigned url. */ fun url(url: String) = url(JsonField.of(url)) @@ -135,16 +112,12 @@ class StoragePresignedUrlCreateResponse private constructor( /** The presigned url. */ @JsonProperty("url") @ExcludeMissing - fun url(url: JsonField) = apply { - this.url = url - } + 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 - } + 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)) @@ -152,9 +125,7 @@ class StoragePresignedUrlCreateResponse private constructor( /** 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 storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -170,11 +141,12 @@ class StoragePresignedUrlCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): StoragePresignedUrlCreateResponse = StoragePresignedUrlCreateResponse( - url, - fields, - storageUri, - additionalProperties.toUnmodifiable(), - ) + fun build(): StoragePresignedUrlCreateResponse = + StoragePresignedUrlCreateResponse( + url, + fields, + storageUri, + additionalProperties.toUnmodifiable(), + ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt index 4ebcf64..357020c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt @@ -2,37 +2,33 @@ package com.openlayer.api.services -import java.io.InputStream -import java.io.OutputStream import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.http.BinaryResponseContent import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerException -import com.openlayer.api.errors.OpenlayerServiceException -import com.openlayer.api.errors.InternalServerException 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 import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException +import java.io.InputStream +import java.io.OutputStream -@JvmSynthetic -internal fun emptyHandler(): Handler = EmptyHandler +@JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandler private object EmptyHandler : Handler { override fun handle(response: HttpResponse): Void? = null } -@JvmSynthetic -internal fun stringHandler(): Handler = StringHandler +@JvmSynthetic internal fun stringHandler(): Handler = StringHandler -@JvmSynthetic -internal fun binaryHandler(): Handler = BinaryHandler +@JvmSynthetic internal fun binaryHandler(): Handler = BinaryHandler private object StringHandler : Handler { override fun handle(response: HttpResponse): String { @@ -42,7 +38,7 @@ private object StringHandler : Handler { private object BinaryHandler : Handler { override fun handle(response: HttpResponse): BinaryResponseContent { - return BinaryResponseContentImpl(response); + return BinaryResponseContentImpl(response) } } @@ -81,10 +77,19 @@ internal fun Handler.withErrorHandler(errorHandler: Handler return this@withErrorHandler.handle(response) 400 -> throw BadRequestException(response.headers(), errorHandler.handle(response)) - 401 -> throw UnauthorizedException(response.headers(), errorHandler.handle(response)) - 403 -> throw PermissionDeniedException(response.headers(), errorHandler.handle(response)) + 401 -> + throw UnauthorizedException(response.headers(), errorHandler.handle(response)) + 403 -> + throw PermissionDeniedException( + response.headers(), + errorHandler.handle(response) + ) 404 -> throw NotFoundException(response.headers(), errorHandler.handle(response)) - 422 -> throw UnprocessableEntityException(response.headers(), errorHandler.handle(response)) + 422 -> + throw UnprocessableEntityException( + response.headers(), + errorHandler.handle(response) + ) 429 -> throw RateLimitException(response.headers(), errorHandler.handle(response)) in 500..599 -> throw InternalServerException( @@ -105,22 +110,21 @@ internal fun Handler.withErrorHandler(errorHandler: Handler json( @@ -50,7 +50,10 @@ internal inline fun json( } @JvmSynthetic -internal fun multipartFormData(jsonMapper: JsonMapper, parts: Array?>): HttpRequestBody { +internal fun multipartFormData( + jsonMapper: JsonMapper, + parts: Array?> +): HttpRequestBody { val builder = MultipartEntityBuilder.create() parts.forEach { part -> if (part?.value != null) { @@ -62,16 +65,30 @@ internal fun multipartFormData(jsonMapper: JsonMapper, parts: Array builder.addTextBody (part.name, if (part.value) "true" else "false", part.contentType) + 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 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}") + else -> + throw IllegalArgumentException( + "Unsupported content type: ${part.value::class.java.simpleName}" + ) } } } 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 a3626b2..92fd5e9 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 @@ -4,41 +4,7 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.commits.TestResultServiceAsync -import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl interface CommitServiceAsync { 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 e9b4b48..ef73e6d 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 @@ -2,47 +2,23 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl +import com.openlayer.api.services.errorHandler -class CommitServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : CommitServiceAsync { +class CommitServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } + private val testResults: TestResultServiceAsync by lazy { + TestResultServiceAsyncImpl(clientOptions) + } override fun testResults(): TestResultServiceAsync = testResults } 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 567e05e..b4419d4 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 @@ -4,45 +4,9 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler 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 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 79cb3f9..5518aff 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 @@ -2,47 +2,21 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler 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.services.errorHandler -class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { +class InferencePipelineServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -50,7 +24,9 @@ class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: C private val rows: RowServiceAsync by lazy { RowServiceAsyncImpl(clientOptions) } - private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } + private val testResults: TestResultServiceAsync by lazy { + TestResultServiceAsyncImpl(clientOptions) + } override fun data(): DataServiceAsync = data 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 91eb662..bc149ca 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 @@ -4,47 +4,14 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions 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.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler 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 java.util.concurrent.CompletableFuture interface ProjectServiceAsync { @@ -54,9 +21,15 @@ interface ProjectServiceAsync { /** Create a project in your workspace. */ @JvmOverloads - fun create(params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture /** List your workspace's projects. */ @JvmOverloads - fun list(params: ProjectListParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun list( + params: ProjectListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): 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 0b4a884..b49f449 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 @@ -2,112 +2,99 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -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.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +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.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.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class ProjectServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : ProjectServiceAsync { +class ProjectServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : ProjectServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - private val inferencePipelines: InferencePipelineServiceAsync by lazy { InferencePipelineServiceAsyncImpl(clientOptions) } + private val inferencePipelines: InferencePipelineServiceAsync by lazy { + InferencePipelineServiceAsyncImpl(clientOptions) + } override fun commits(): CommitServiceAsync = commits override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 831de31..6a59073 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 @@ -4,41 +4,7 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync -import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl interface StorageServiceAsync { 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 dac3cb2..2dd732c 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 @@ -2,47 +2,23 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl +import com.openlayer.api.services.errorHandler -class StorageServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : StorageServiceAsync { +class StorageServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : StorageServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val presignedUrl: PresignedUrlServiceAsync by lazy { PresignedUrlServiceAsyncImpl(clientOptions) } + private val presignedUrl: PresignedUrlServiceAsync by lazy { + PresignedUrlServiceAsyncImpl(clientOptions) + } override fun presignedUrl(): PresignedUrlServiceAsync = 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 a466cbe..dde3ea2 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 @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface TestResultServiceAsync { /** List the test results for a project commit (project version). */ @JvmOverloads - fun list(params: CommitTestResultListParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 a200f69..ac4c25f 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 @@ -2,70 +2,53 @@ package com.openlayer.api.services.async.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : TestResultServiceAsync { +class TestResultServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 3fab390..4f079ec 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 @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface DataServiceAsync { /** Publish an inference data point to an inference pipeline. */ @JvmOverloads - fun stream(params: InferencePipelineDataStreamParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 23f28ed..bbbf784 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 @@ -2,71 +2,55 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class DataServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : DataServiceAsync { +class DataServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - streamHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 40dfad8..4522c37 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 @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface RowServiceAsync { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 8fe8680..9304fa7 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 @@ -2,71 +2,55 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class RowServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : RowServiceAsync { +class RowServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : RowServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - updateHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 7b0b75c..5d526af 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 @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface TestResultServiceAsync { /** List the latest test results for an inference pipeline. */ @JvmOverloads - fun list(params: InferencePipelineTestResultListParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 3bdda30..0b4305b 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 @@ -2,70 +2,53 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : TestResultServiceAsync { +class TestResultServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 1157a3e..cc723f2 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 @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface CommitServiceAsync { /** List the commits (project versions) in a project. */ @JvmOverloads - fun list(params: ProjectCommitListParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 8f74835..9fb60aa 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 @@ -2,70 +2,53 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class CommitServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : CommitServiceAsync { +class CommitServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 f9abcdd..a0a6c63 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 @@ -4,51 +4,26 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions 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.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface InferencePipelineServiceAsync { /** Create an inference pipeline in a project. */ @JvmOverloads - fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture /** List the inference pipelines in a project. */ @JvmOverloads - fun list(params: ProjectInferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 656838b..262589d 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 @@ -2,100 +2,87 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -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.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +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.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { +class InferencePipelineServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 3037188..933abd8 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 @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface PresignedUrlServiceAsync { /** Retrieve a presigned url to post storage artifacts. */ @JvmOverloads - fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 d084d4a..65a6972 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 @@ -2,75 +2,55 @@ package com.openlayer.api.services.async.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class PresignedUrlServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : PresignedUrlServiceAsync { +class PresignedUrlServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : PresignedUrlServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .apply { - params.getBody().ifPresent { - body(json(clientOptions.jsonMapper, it)) - } + override fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().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() + } + } } - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 2399953..86553e1 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 @@ -4,41 +4,7 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.commits.TestResultService -import com.openlayer.api.services.blocking.commits.TestResultServiceImpl 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 4def18e..cae0abd 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 @@ -2,43 +2,17 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl +import com.openlayer.api.services.errorHandler -class CommitServiceImpl constructor(private val clientOptions: ClientOptions, ) : CommitService { +class CommitServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 fc40959..157d71f 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 @@ -4,45 +4,9 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler 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 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 562c292..2267d4a 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 @@ -2,47 +2,21 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler 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.services.errorHandler -class InferencePipelineServiceImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineService { +class InferencePipelineServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 2cd51fd..a9e58d1 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 @@ -4,47 +4,13 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions 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.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler 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 interface ProjectService { @@ -54,9 +20,15 @@ interface ProjectService { /** Create a project in your workspace. */ @JvmOverloads - fun create(params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectCreateResponse + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectCreateResponse /** List your workspace's projects. */ @JvmOverloads - fun list(params: ProjectListParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectListResponse + fun list( + params: ProjectListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectListResponse } 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 d68b80d..e441602 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 @@ -2,112 +2,96 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -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.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +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.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.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler -class ProjectServiceImpl constructor(private val clientOptions: ClientOptions, ) : ProjectService { +class ProjectServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : ProjectService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - private val inferencePipelines: InferencePipelineService by lazy { InferencePipelineServiceImpl(clientOptions) } + private val inferencePipelines: InferencePipelineService by lazy { + InferencePipelineServiceImpl(clientOptions) + } override fun commits(): CommitService = commits override fun inferencePipelines(): InferencePipelineService = inferencePipelines private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions + ): ProjectCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions + ): ProjectListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 072edaa..bd8b0a0 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 @@ -4,41 +4,7 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.storage.PresignedUrlService -import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl interface StorageService { 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 152a709..25ff043 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 @@ -2,43 +2,17 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl +import com.openlayer.api.services.errorHandler -class StorageServiceImpl constructor(private val clientOptions: ClientOptions, ) : StorageService { +class StorageServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : StorageService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 02b5449..5ad32ef 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 @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface TestResultService { /** List the test results for a project commit (project version). */ @JvmOverloads - fun list(params: CommitTestResultListParams, requestOptions: RequestOptions = RequestOptions.none()): CommitTestResultListResponse + fun list( + params: CommitTestResultListParams, + 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 9b3716f..01739b4 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 @@ -2,70 +2,51 @@ package com.openlayer.api.services.blocking.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class TestResultServiceImpl constructor(private val clientOptions: ClientOptions, ) : TestResultService { +class TestResultServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions + ): CommitTestResultListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 973e01e..bbfd2cf 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 @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface DataService { /** Publish an inference data point to an inference pipeline. */ @JvmOverloads - fun stream(params: InferencePipelineDataStreamParams, requestOptions: RequestOptions = RequestOptions.none()): InferencePipelineDataStreamResponse + fun stream( + params: InferencePipelineDataStreamParams, + 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 f4657c4..41c4268 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 @@ -2,71 +2,53 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class DataServiceImpl constructor(private val clientOptions: ClientOptions, ) : DataService { +class DataServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - streamHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions + ): InferencePipelineDataStreamResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 771f4f0..3548f85 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 @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface RowService { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none()): InferencePipelineRowUpdateResponse + fun update( + params: InferencePipelineRowUpdateParams, + 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 664a7d9..d5f73a0 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 @@ -2,71 +2,53 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class RowServiceImpl constructor(private val clientOptions: ClientOptions, ) : RowService { +class RowServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : RowService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - updateHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions + ): InferencePipelineRowUpdateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 7688894..24e0ca5 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 @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface TestResultService { /** List the latest test results for an inference pipeline. */ @JvmOverloads - fun list(params: InferencePipelineTestResultListParams, requestOptions: RequestOptions = RequestOptions.none()): InferencePipelineTestResultListResponse + fun list( + params: InferencePipelineTestResultListParams, + 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 431decf..675b14f 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 @@ -2,70 +2,51 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class TestResultServiceImpl constructor(private val clientOptions: ClientOptions, ) : TestResultService { +class TestResultServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions + ): InferencePipelineTestResultListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 6f1451a..c9fb11e 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 @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface CommitService { /** List the commits (project versions) in a project. */ @JvmOverloads - fun list(params: ProjectCommitListParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectCommitListResponse + fun list( + params: ProjectCommitListParams, + 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 298595e..6cb0342 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 @@ -2,70 +2,51 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class CommitServiceImpl constructor(private val clientOptions: ClientOptions, ) : CommitService { +class CommitServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions + ): ProjectCommitListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 82b7049..93989fb 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 @@ -4,51 +4,25 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions 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.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface InferencePipelineService { /** Create an inference pipeline in a project. */ @JvmOverloads - fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectInferencePipelineCreateResponse + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectInferencePipelineCreateResponse /** List the inference pipelines in a project. */ @JvmOverloads - fun list(params: ProjectInferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectInferencePipelineListResponse + fun list( + params: ProjectInferencePipelineListParams, + 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 aff9b37..cb8655e 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 @@ -2,100 +2,84 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -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.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +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.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class InferencePipelineServiceImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineService { +class InferencePipelineServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions + ): ProjectInferencePipelineCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } } private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - listHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions + ): ProjectInferencePipelineListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 f1e6882..6cc179e 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 @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse -import com.openlayer.api.core.ClientOptions -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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface PresignedUrlService { /** Retrieve a presigned url to post storage artifacts. */ @JvmOverloads - fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none()): StoragePresignedUrlCreateResponse + fun create( + params: StoragePresignedUrlCreateParams, + 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 428d207..dabbfe5 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 @@ -2,75 +2,53 @@ package com.openlayer.api.services.blocking.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions 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.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class PresignedUrlServiceImpl constructor(private val clientOptions: ClientOptions, ) : PresignedUrlService { +class PresignedUrlServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : PresignedUrlService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** 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") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .apply { - params.getBody().ifPresent { - body(json(clientOptions.jsonMapper, it)) - } + override fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions + ): StoragePresignedUrlCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().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() + } + } } - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - 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 c0b74a2..0d72bda 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 @@ -43,9 +43,13 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { override fun evaluateExecutionCondition(context: ExtensionContext): ConditionEvaluationResult { return if (System.getenv(SKIP_TESTS_ENV).toBoolean()) { - ConditionEvaluationResult.disabled("Environment variable $SKIP_TESTS_ENV is set to true") + ConditionEvaluationResult.disabled( + "Environment variable $SKIP_TESTS_ENV is set to true" + ) } else { - ConditionEvaluationResult.enabled("Environment variable $SKIP_TESTS_ENV is not set to true") + ConditionEvaluationResult.enabled( + "Environment variable $SKIP_TESTS_ENV is not set to true" + ) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt index a96c62f..bf5ebe7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt @@ -2,8 +2,4 @@ package com.openlayer.api.client -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - class OpenlayerClientTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt index cb72e6a..fe7fc1c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt @@ -1,20 +1,22 @@ package com.openlayer.api.core.http -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test internal class HttpRequestTest { @Test fun caseInsensitiveHeadersAccessors() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .putHeader("something_lowercase", "lowercase") - .putHeader("Something_Capitalized", "Capitalized") - .putHeader("SOMETHING_UPPERCASE", "UPPERCASE") - .build() + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .putHeader("something_lowercase", "lowercase") + .putHeader("Something_Capitalized", "Capitalized") + .putHeader("SOMETHING_UPPERCASE", "UPPERCASE") + .build() assertThat(request.headers.get("SOMETHING_LOWERCASE").getOrNull(0)).isEqualTo("lowercase") - assertThat(request.headers.get("something_capitalized").getOrNull(0)).isEqualTo("Capitalized") + assertThat(request.headers.get("something_capitalized").getOrNull(0)) + .isEqualTo("Capitalized") assertThat(request.headers.get("Something_Uppercase").getOrNull(0)).isEqualTo("UPPERCASE") } } 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 3bd34e1..ce97799 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 @@ -1,14 +1,13 @@ package com.openlayer.api.core.http +import com.github.tomakehurst.wiremock.client.WireMock.* 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 org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import com.github.tomakehurst.wiremock.stubbing.Scenario -import com.github.tomakehurst.wiremock.client.WireMock.* @WireMockTest internal class RetryingHttpClientTest { @@ -17,25 +16,16 @@ internal class RetryingHttpClientTest { @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - httpClient = OkHttpClient.builder() - .baseUrl(wmRuntimeInfo.httpBaseUrl) - .build() + httpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() resetAllScenarios() } @Test fun byDefaultShouldNotAddIdempotencyHeaderToRequest() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() - stubFor( - post(urlPathEqualTo("/something")) - .willReturn(ok()) - ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) + val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) @@ -43,19 +33,18 @@ internal class RetryingHttpClientTest { @Test fun whenProvidedShouldAddIdempotencyHeaderToRequest() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( post(urlPathEqualTo("/something")) .withHeader("X-Some-Header", matching("stainless-java-retry-.+")) .willReturn(ok()) ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .idempotencyHeader("X-Some-Header") - .build() + val retryingClient = + RetryingHttpClient.builder() + .httpClient(httpClient) + .idempotencyHeader("X-Some-Header") + .build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) @@ -63,15 +52,15 @@ internal class RetryingHttpClientTest { @Test fun retryAfterHeader() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") // first we fail with a retry after header given as a date .whenScenarioStateIs(Scenario.STARTED) - .willReturn(serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT")) + .willReturn( + serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT") + ) .willSetStateTo("RETRY_AFTER_DATE") ) stubFor( @@ -88,10 +77,8 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .maxRetries(2) - .build() + val retryingClient = + RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(3, postRequestedFor(urlPathEqualTo("/something"))) @@ -99,10 +86,8 @@ internal class RetryingHttpClientTest { @Test fun retryAfterMsHeader() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") @@ -117,10 +102,8 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .maxRetries(1) - .build() + val retryingClient = + RetryingHttpClient.builder().httpClient(httpClient).maxRetries(1).build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(2, postRequestedFor(urlPathEqualTo("/something"))) 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 bed3d64..a2f9465 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 @@ -5,9 +5,9 @@ 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 -import java.util.* internal class SerializerTest { @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) @@ -23,9 +23,7 @@ internal class SerializerTest { fun isActive(): Boolean? = isActive.getNullable("is_active") - @JsonProperty("is_active") - @ExcludeMissing - fun _isActive() = isActive + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive @JsonAnyGetter @ExcludeMissing @@ -44,28 +42,30 @@ internal class SerializerTest { } return other is ClassWithBooleanFieldPrefixedWithIs && - isActive == other.isActive && - additionalProperties == other.additionalProperties + isActive == other.isActive && + additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash( - isActive, - additionalProperties, - ) + hashCode = + Objects.hash( + isActive, + additionalProperties, + ) } return hashCode } - override fun toString() = "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" + override fun toString() = + "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" companion object { fun builder() = Builder() } @NoAutoDetect - class Builder{ + class Builder { private var isActive: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -73,9 +73,7 @@ internal class SerializerTest { @JsonProperty("is_active") @ExcludeMissing - fun isActive(isActive: JsonField) = apply { - this.isActive = isActive - } + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -91,14 +89,14 @@ internal class SerializerTest { this.additionalProperties.putAll(additionalProperties) } - fun build(): ClassWithBooleanFieldPrefixedWithIs = ClassWithBooleanFieldPrefixedWithIs( - isActive, - additionalProperties.toUnmodifiable(), - ) + fun build(): ClassWithBooleanFieldPrefixedWithIs = + ClassWithBooleanFieldPrefixedWithIs( + isActive, + additionalProperties.toUnmodifiable(), + ) } } - @Test fun serializeBooleanPrefixedWithIs() { val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() 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 a609eae..a011d78 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 @@ -2,72 +2,64 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.CommitTestResultListParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class CommitTestResultListParamsTest { @Test fun createCommitTestResultListParams() { - CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() } @Test fun getQueryParams() { - val params = CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build() - val expected = mutableMapOf>() - expected.put("includeArchived", listOf("true")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) - expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("includeArchived", listOf("true")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) + expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = CommitTestResultListParams.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("") + val params = + CommitTestResultListParams.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/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt index 8991770..05c6717 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 @@ -2,119 +2,160 @@ package com.openlayer.api.models -import java.time.LocalDate +import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.CommitTestResultListResponse +import org.junit.jupiter.api.Test class CommitTestResultListResponseTest { @Test fun createCommitTestResultListResponse() { - val commitTestResultListResponse = CommitTestResultListResponse.builder() - ._meta(CommitTestResultListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - .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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds(listOf(CommitTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters(listOf(JsonValue.from(mapOf()))) - .measurement("duplicateRowCount") - .operator("<=") - .value(CommitTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) - .build())) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build()) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build())) - .build() - assertThat(commitTestResultListResponse).isNotNull - assertThat(commitTestResultListResponse._meta()).isEqualTo(CommitTestResultListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - assertThat(commitTestResultListResponse.items()).containsExactly(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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds(listOf(CommitTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters(listOf(JsonValue.from(mapOf()))) - .measurement("duplicateRowCount") - .operator("<=") - .value(CommitTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) - .build())) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build()) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) + val commitTestResultListResponse = + CommitTestResultListResponse.builder() + ._meta( + CommitTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + CommitTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + CommitTestResultListResponse.Item.Goal.Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + ) + .build() + assertThat(commitTestResultListResponse).isNotNull + assertThat(commitTestResultListResponse._meta()) + .isEqualTo( + CommitTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(commitTestResultListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + CommitTestResultListResponse.Item.Goal.Threshold.Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) } } 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 eb626b4..de558c5 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 @@ -2,124 +2,157 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamParams.InferencePipelineDataStreamBody +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class InferencePipelineDataStreamParamsTest { @Test fun createInferencePipelineDataStreamParams() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.config()).isEqualTo(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - assertThat(body.rows()).isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()) + .isEqualTo( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + assertThat(body.rows()) + .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) } @Test fun getBodyWithoutOptionalFields() { - val params = InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.config()).isEqualTo(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build())) - assertThat(body.rows()).isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()) + .isEqualTo( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + assertThat(body.rows()) + .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) } @Test fun getPathParam() { - val params = InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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("") + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt index 47cd2e3..5d5c07f 100644 --- 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 @@ -2,25 +2,19 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineDataStreamResponse +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) + 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/InferencePipelineRowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt index 2d4d4e4..f4a70bf 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 @@ -2,120 +2,123 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateParams.InferencePipelineRowUpdateBody +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class InferencePipelineRowUpdateParamsTest { @Test fun createInferencePipelineRowUpdateParams() { - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build() + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() } @Test fun getQueryParams() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build() - val expected = mutableMapOf>() - expected.put("inferenceId", listOf("inferenceId")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .build() - val expected = mutableMapOf>() - expected.put("inferenceId", listOf("inferenceId")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getBody() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) - assertThat(body.config()).isEqualTo(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body.config()) + .isEqualTo( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) } @Test fun getBodyWithoutOptionalFields() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) } @Test fun getPathParam() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .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("") + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .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/InferencePipelineRowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt index e6f8d09..427675b 100644 --- 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 @@ -2,25 +2,19 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +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) + 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/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt index 06208f7..6de2ac0 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 @@ -2,69 +2,67 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.InferencePipelineTestResultListParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class InferencePipelineTestResultListParamsTest { @Test fun createInferencePipelineTestResultListParams() { - InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() } @Test fun getQueryParams() { - val params = InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build() - val expected = mutableMapOf>() - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("status", listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString())) - expected.put("type", listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put( + "status", + listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString()) + ) + expected.put( + "type", + listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) + ) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = InferencePipelineTestResultListParams.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("") + val params = + InferencePipelineTestResultListParams.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/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt index bd2060f..d9eadbb 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 @@ -2,119 +2,166 @@ package com.openlayer.api.models -import java.time.LocalDate +import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import org.junit.jupiter.api.Test class InferencePipelineTestResultListResponseTest { @Test fun createInferencePipelineTestResultListResponse() { - val inferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse.builder() - ._meta(InferencePipelineTestResultListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - .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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds(listOf(InferencePipelineTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters(listOf(JsonValue.from(mapOf()))) - .measurement("duplicateRowCount") - .operator("<=") - .value(InferencePipelineTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) - .build())) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build()) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build())) - .build() - assertThat(inferencePipelineTestResultListResponse).isNotNull - assertThat(inferencePipelineTestResultListResponse._meta()).isEqualTo(InferencePipelineTestResultListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - assertThat(inferencePipelineTestResultListResponse.items()).containsExactly(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(123L) - .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(123L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(true) - .thresholds(listOf(InferencePipelineTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters(listOf(JsonValue.from(mapOf()))) - .measurement("duplicateRowCount") - .operator("<=") - .value(InferencePipelineTestResultListResponse.Item.Goal.Threshold.Value.ofDouble(42.23)) - .build())) - .type("integrity") - .archived(true) - .delayWindow(42.23) - .evaluationWindow(42.23) - .usesMlModel(true) - .usesProductionData(true) - .usesReferenceDataset(true) - .usesTrainingDataset(true) - .usesValidationDataset(true) - .build()) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) + val inferencePipelineTestResultListResponse = + InferencePipelineTestResultListResponse.builder() + ._meta( + InferencePipelineTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + InferencePipelineTestResultListResponse.Item.Goal + .Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + InferencePipelineTestResultListResponse.Item + .Goal + .Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + ) + .build() + assertThat(inferencePipelineTestResultListResponse).isNotNull + assertThat(inferencePipelineTestResultListResponse._meta()) + .isEqualTo( + InferencePipelineTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(inferencePipelineTestResultListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + InferencePipelineTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + InferencePipelineTestResultListResponse.Item.Goal + .Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) } } 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 d843e16..17d2e0a 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 @@ -2,63 +2,55 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectCommitListParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectCommitListParamsTest { @Test fun createProjectCommitListParams() { - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() } @Test fun getQueryParams() { - val params = ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = ProjectCommitListParams.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("") + val params = + ProjectCommitListParams.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/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt index 706ad5b..5793bd5 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 @@ -2,103 +2,123 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectCommitListResponse +import org.junit.jupiter.api.Test class ProjectCommitListResponseTest { @Test fun createProjectCommitListResponse() { - val projectCommitListResponse = ProjectCommitListResponse.builder() - ._meta(ProjectCommitListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - .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(123L) - .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(123L) - .gitCommitUrl("gitCommitUrl") - .build()) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links(ProjectCommitListResponse.Item.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .build())) - .build() - assertThat(projectCommitListResponse).isNotNull - assertThat(projectCommitListResponse._meta()).isEqualTo(ProjectCommitListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - assertThat(projectCommitListResponse.items()).containsExactly(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(123L) - .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(123L) - .gitCommitUrl("gitCommitUrl") - .build()) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links(ProjectCommitListResponse.Item.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .build()) + val projectCommitListResponse = + ProjectCommitListResponse.builder() + ._meta( + ProjectCommitListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(123L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(true) + .deploymentStatus("Deployed") + .links( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + ) + .build() + assertThat(projectCommitListResponse).isNotNull + assertThat(projectCommitListResponse._meta()) + .isEqualTo( + ProjectCommitListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectCommitListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(123L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(true) + .deploymentStatus("Deployed") + .links( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) } } 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 859a38c..0a0a757 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,56 +2,46 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateParams.ProjectCreateBody +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectCreateParamsTest { @Test fun createProjectCreateParams() { - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() } @Test fun getBody() { - val params = ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("My Project") - assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) - assertThat(body.description()).isEqualTo("My project description.") + val params = + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + assertThat(body.description()).isEqualTo("My project description.") } @Test fun getBodyWithoutOptionalFields() { - val params = ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("My Project") - assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + val params = + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) } } 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/ProjectCreateResponseTest.kt index cebddea..1fc43bb 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/ProjectCreateResponseTest.kt @@ -2,85 +2,98 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectCreateResponse +import org.junit.jupiter.api.Test class ProjectCreateResponseTest { @Test fun createProjectCreateResponse() { - 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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links(ProjectCreateResponse.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectCreateResponse.Source.WEB) - .taskType(ProjectCreateResponse.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) - .build() - assertThat(projectCreateResponse).isNotNull - assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCreateResponse.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") - assertThat(projectCreateResponse.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCreateResponse.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) - assertThat(projectCreateResponse.links()).isEqualTo(ProjectCreateResponse.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.name()).isEqualTo("My Project") - assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) - assertThat(projectCreateResponse.taskType()).isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) - assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) - assertThat(projectCreateResponse.workspaceId()).contains("055fddb1-261f-4654-8598-f6347ee46a09") - assertThat(projectCreateResponse.description()).contains("My project description.") - assertThat(projectCreateResponse.gitRepo()).contains(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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) + 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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectCreateResponse.Source.WEB) + .taskType(ProjectCreateResponse.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + assertThat(projectCreateResponse).isNotNull + assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectCreateResponse.creatorId()) + .contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(projectCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) + assertThat(projectCreateResponse.links()) + .isEqualTo( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.name()).isEqualTo("My Project") + assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) + assertThat(projectCreateResponse.taskType()) + .isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) + assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) + assertThat(projectCreateResponse.workspaceId()) + .contains("055fddb1-261f-4654-8598-f6347ee46a09") + assertThat(projectCreateResponse.description()).contains("My project description.") + assertThat(projectCreateResponse.gitRepo()) + .contains( + 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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) } } 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 f64c627..0e96084 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,67 +2,58 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateParams.ProjectInferencePipelineCreateBody +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectInferencePipelineCreateParamsTest { @Test fun createProjectInferencePipelineCreateParams() { - ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .build() + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() } @Test fun getBody() { - 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()).isEqualTo("This pipeline is used for production.") - assertThat(body.name()).isEqualTo("production") + 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()).isEqualTo("This pipeline is used for production.") + assertThat(body.name()).isEqualTo("production") } @Test fun getBodyWithoutOptionalFields() { - val params = ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("production") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("production") + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("production") } @Test fun getPathParam() { - val params = ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("production") - .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("") + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .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/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt index 064535b..2398c71 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 @@ -2,57 +2,70 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import org.junit.jupiter.api.Test class ProjectInferencePipelineCreateResponseTest { @Test fun createProjectInferencePipelineCreateResponse() { - val projectInferencePipelineCreateResponse = ProjectInferencePipelineCreateResponse.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(123L) - .links(ProjectInferencePipelineCreateResponse.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .name("production") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .build() - assertThat(projectInferencePipelineCreateResponse).isNotNull - assertThat(projectInferencePipelineCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.description()).contains("This pipeline is used for production.") - assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) - assertThat(projectInferencePipelineCreateResponse.links()).isEqualTo(ProjectInferencePipelineCreateResponse.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(123L) - assertThat(projectInferencePipelineCreateResponse.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.status()).isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) - assertThat(projectInferencePipelineCreateResponse.statusMessage()).contains("Tests successfully evaluated") - assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) + val projectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse.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(123L) + .links( + ProjectInferencePipelineCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + assertThat(projectInferencePipelineCreateResponse).isNotNull + assertThat(projectInferencePipelineCreateResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.description()) + .contains("This pipeline is used for production.") + assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.links()) + .isEqualTo( + ProjectInferencePipelineCreateResponse.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(123L) + assertThat(projectInferencePipelineCreateResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.status()) + .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) + assertThat(projectInferencePipelineCreateResponse.statusMessage()) + .contains("Tests successfully evaluated") + assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) } } 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 99c2565..671b802 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 @@ -2,66 +2,58 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectInferencePipelineListParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectInferencePipelineListParamsTest { @Test fun createProjectInferencePipelineListParams() { - ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build() + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() } @Test fun getQueryParams() { - val params = ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("name")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("name")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getPathParam() { - val params = ProjectInferencePipelineListParams.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("") + val params = + ProjectInferencePipelineListParams.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/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt index f27c2c3..37bb0ca 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 @@ -2,73 +2,91 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectInferencePipelineListResponse +import org.junit.jupiter.api.Test class ProjectInferencePipelineListResponseTest { @Test fun createProjectInferencePipelineListResponse() { - val projectInferencePipelineListResponse = ProjectInferencePipelineListResponse.builder() - ._meta(ProjectInferencePipelineListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - .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(123L) - .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(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .build())) - .build() - assertThat(projectInferencePipelineListResponse).isNotNull - assertThat(projectInferencePipelineListResponse._meta()).isEqualTo(ProjectInferencePipelineListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - assertThat(projectInferencePipelineListResponse.items()).containsExactly(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(123L) - .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(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(123L) - .build()) + val projectInferencePipelineListResponse = + ProjectInferencePipelineListResponse.builder() + ._meta( + ProjectInferencePipelineListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + ) + ) + .build() + assertThat(projectInferencePipelineListResponse).isNotNull + assertThat(projectInferencePipelineListResponse._meta()) + .isEqualTo( + ProjectInferencePipelineListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectInferencePipelineListResponse.items()) + .containsExactly( + 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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + ) } } 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 7b8d3a1..daf73e7 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 @@ -2,53 +2,43 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectListParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectListParamsTest { @Test fun createProjectListParams() { - ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() } @Test fun getQueryParams() { - val params = ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("name")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("name")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = ProjectListParams.builder().build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectListParams.builder().build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } } 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 7e0cf3d..c30dee9 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 @@ -2,101 +2,121 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectListResponse +import org.junit.jupiter.api.Test class ProjectListResponseTest { @Test fun createProjectListResponse() { - val projectListResponse = ProjectListResponse.builder() - ._meta(ProjectListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - .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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links(ProjectListResponse.Item.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) - .build())) - .build() - assertThat(projectListResponse).isNotNull - assertThat(projectListResponse._meta()).isEqualTo(ProjectListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - assertThat(projectListResponse.items()).containsExactly(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(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links(ProjectListResponse.Item.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(123L) - .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(123L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) - .build()) + val projectListResponse = + ProjectListResponse.builder() + ._meta( + ProjectListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links( + ProjectListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + ) + .build() + assertThat(projectListResponse).isNotNull + assertThat(projectListResponse._meta()) + .isEqualTo( + ProjectListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectListResponse.items()) + .containsExactly( + 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(123L) + .goalCount(123L) + .inferencePipelineCount(123L) + .links( + ProjectListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(123L) + .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(123L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .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 ff29905..6ae03e8 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 @@ -2,47 +2,30 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.StoragePresignedUrlCreateParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class StoragePresignedUrlCreateParamsTest { @Test fun createStoragePresignedUrlCreateParams() { - StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build() + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() } @Test fun getQueryParams() { - val params = StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build() - val expected = mutableMapOf>() - expected.put("objectName", listOf("objectName")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build() - val expected = mutableMapOf>() - expected.put("objectName", listOf("objectName")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) } } 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 index 9e63230..c6dd2f5 100644 --- 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 @@ -2,29 +2,24 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +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())) + 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/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index c5b8310..4dfd4b0 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,37 +2,19 @@ package com.openlayer.api.services -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest -import com.github.tomakehurst.wiremock.client.WireMock.binaryEqualTo -import com.github.tomakehurst.wiremock.client.WireMock.equalTo +import com.fasterxml.jackson.databind.json.JsonMapper +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.get import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.post -import com.github.tomakehurst.wiremock.client.WireMock.put -import com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor -import com.github.tomakehurst.wiremock.client.WireMock.delete import com.github.tomakehurst.wiremock.client.WireMock.status import com.github.tomakehurst.wiremock.client.WireMock.stubFor -import com.github.tomakehurst.wiremock.client.WireMock.anyUrl -import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import org.assertj.guava.api.Assertions.assertThat -import com.google.common.collect.ListMultimap +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.google.common.collect.ImmutableListMultimap -import com.fasterxml.jackson.databind.json.JsonMapper -import java.io.IOException -import java.time.LocalDate -import java.time.OffsetDateTime -import java.util.UUID -import org.assertj.core.api.InstanceOfAssertFactories -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import java.io.InputStream -import java.io.ByteArrayOutputStream +import com.google.common.collect.ListMultimap import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper @@ -41,439 +23,657 @@ 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.OpenlayerServiceException 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 com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.assertThatThrownBy +import org.assertj.core.api.InstanceOfAssertFactories +import org.assertj.guava.api.Assertions.assertThat +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test @WireMockTest class ErrorHandlingTest { private val JSON_MAPPER: JsonMapper = jsonMapper() - private val OPENLAYER_ERROR: OpenlayerError = OpenlayerError.builder().putAdditionalProperty("key", JsonString.of("value")).build() + private val OPENLAYER_ERROR: OpenlayerError = + OpenlayerError.builder().putAdditionalProperty("key", JsonString.of("value")).build() private lateinit var client: OpenlayerClient @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = OpenlayerOkHttpClient.builder() - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) - .apiKey("My API Key") - .build() + client = + OpenlayerOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) + .apiKey("My API Key") + .build() } @Test fun dataStream200() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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) } @Test fun dataStream400() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream401() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream403() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream404() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream422() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertUnprocessableEntity(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertUnprocessableEntity( + e, + ImmutableListMultimap.of("Foo", "Bar"), + OPENLAYER_ERROR + ) + }) } @Test fun dataStream429() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream500() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun unexpectedStatusCode() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertUnexpectedStatusCodeException(e, 999, ImmutableListMultimap.of("Foo", "Bar"), toJson(OPENLAYER_ERROR)) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor( + post(anyUrl()) + .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertUnexpectedStatusCodeException( + e, + 999, + ImmutableListMultimap.of("Foo", "Bar"), + toJson(OPENLAYER_ERROR) + ) + }) } @Test fun invalidBody() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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") }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().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") + }) } @Test fun invalidErrorBody() { - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build() - - stubFor(post(anyUrl()) - .willReturn(status(400).withBody("Not JSON"))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) }) + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + + stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) + }) } private fun toJson(body: T): ByteArray { - return JSON_MAPPER.writeValueAsBytes(body) + return JSON_MAPPER.writeValueAsBytes(body) } - private fun assertUnexpectedStatusCodeException(throwable: Throwable, statusCode: Int, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertUnexpectedStatusCodeException( + throwable: Throwable, + statusCode: Int, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertBadRequest(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertBadRequest( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertUnauthorized(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertUnauthorized( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertPermissionDenied(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertPermissionDenied( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertNotFound(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertNotFound( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertUnprocessableEntity(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertUnprocessableEntity( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertRateLimit(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertRateLimit( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } - private fun assertInternalServer(throwable: Throwable, headers: ListMultimap, 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()).containsAllEntriesOf(headers) }) + private fun assertInternalServer( + throwable: Throwable, + headers: ListMultimap, + 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()).containsAllEntriesOf(headers) + }) } } 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 9bf6fd7..4378175 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 @@ -3,41 +3,26 @@ package com.openlayer.api.services import com.fasterxml.jackson.databind.json.JsonMapper -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.equalTo -import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.get +import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath +import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.post +import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor import com.github.tomakehurst.wiremock.client.WireMock.put -import com.github.tomakehurst.wiremock.client.WireMock.delete -import com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor import com.github.tomakehurst.wiremock.client.WireMock.stubFor -import com.github.tomakehurst.wiremock.client.WireMock.anyUrl -import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath import com.github.tomakehurst.wiremock.client.WireMock.verify -import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor -import com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor -import java.io.IOException -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +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.jsonMapper -import com.openlayer.api.core.JsonNull import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.errors.OpenlayerServiceException -import com.openlayer.api.errors.UnexpectedStatusCodeException +import com.openlayer.api.core.jsonMapper import com.openlayer.api.models.* +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test @WireMockTest class ServiceParamsTest { @@ -48,63 +33,77 @@ class ServiceParamsTest { @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = OpenlayerOkHttpClient.builder() - .apiKey("My API Key") - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) - .build() + client = + OpenlayerOkHttpClient.builder() + .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", JsonString.of("ghi890")) - - 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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .additionalHeaders(additionalHeaders) - .additionalBodyProperties(additionalBodyProperties) - .additionalQueryParams(additionalQueryParams) - .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())) + 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", JsonString.of("ghi890")) + + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .additionalHeaders(additionalHeaders) + .additionalBodyProperties(additionalBodyProperties) + .additionalQueryParams(additionalQueryParams) + .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())) } } 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 123ebae..4a62862 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 @@ -2,26 +2,8 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.CommitService import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class CommitServiceTest +@ExtendWith(TestServerExtension::class) class CommitServiceTest 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 74b59ea..af33b2f 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 @@ -2,26 +2,8 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.InferencePipelineService import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class InferencePipelineServiceTest +@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest 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 d00b28d..a87bdef 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 @@ -2,60 +2,53 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.ProjectService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class ProjectServiceTest { @Test fun callCreate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectCreateResponse = projectService.create(ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build()) - println(projectCreateResponse) - projectCreateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectCreateResponse = + projectService.create( + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() + ) + println(projectCreateResponse) + projectCreateResponse.validate() } @Test fun callList() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectListResponse = projectService.list(ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build()) - println(projectListResponse) - projectListResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectListResponse = + projectService.list( + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + ) + println(projectListResponse) + projectListResponse.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt index 354c84e..5c66b4e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt @@ -2,26 +2,8 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.StorageService import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class StorageServiceTest +@ExtendWith(TestServerExtension::class) class StorageServiceTest 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 1810f70..1f87370 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 @@ -2,46 +2,35 @@ package com.openlayer.api.services.blocking.commits -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class TestResultServiceTest { @Test fun callList() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val testResultService = client.commits().testResults() - val commitTestResultListResponse = testResultService.list(CommitTestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .includeArchived(true) - .page(123L) - .perPage(100L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) - .build()) - println(commitTestResultListResponse) - commitTestResultListResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.commits().testResults() + val commitTestResultListResponse = + testResultService.list( + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + ) + println(commitTestResultListResponse) + commitTestResultListResponse.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 6505192..0b70b54 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 @@ -2,59 +2,58 @@ package com.openlayer.api.services.blocking.inferencePipelines -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.inferencePipelines.DataService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class DataServiceTest { @Test fun callStream() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val dataService = client.inferencePipelines().data() - val inferencePipelineDataStreamResponse = dataService.stream(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("string")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("num_tokens") - .prompt(listOf(InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build())) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build())) - .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) - .build()) - println(inferencePipelineDataStreamResponse) - inferencePipelineDataStreamResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dataService = client.inferencePipelines().data() + val inferencePipelineDataStreamResponse = + dataService.stream( + 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("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + ) + println(inferencePipelineDataStreamResponse) + inferencePipelineDataStreamResponse.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 1e1a086..8347fd9 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 @@ -2,50 +2,42 @@ package com.openlayer.api.services.blocking.inferencePipelines -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.inferencePipelines.RowService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class RowServiceTest { @Test fun callUpdate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val rowService = client.inferencePipelines().rows() - val inferencePipelineRowUpdateResponse = rowService.update(InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build()) - println(inferencePipelineRowUpdateResponse) - inferencePipelineRowUpdateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val rowService = client.inferencePipelines().rows() + val inferencePipelineRowUpdateResponse = + rowService.update( + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + ) + println(inferencePipelineRowUpdateResponse) + inferencePipelineRowUpdateResponse.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 046ecaa..67a11f1 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 @@ -2,45 +2,34 @@ package com.openlayer.api.services.blocking.inferencePipelines -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.inferencePipelines.TestResultService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class TestResultServiceTest { @Test fun callList() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val testResultService = client.inferencePipelines().testResults() - val inferencePipelineTestResultListResponse = testResultService.list(InferencePipelineTestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) - .build()) - println(inferencePipelineTestResultListResponse) - inferencePipelineTestResultListResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.inferencePipelines().testResults() + val inferencePipelineTestResultListResponse = + testResultService.list( + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + ) + println(inferencePipelineTestResultListResponse) + inferencePipelineTestResultListResponse.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 60412bc..83a9c12 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 @@ -2,43 +2,32 @@ package com.openlayer.api.services.blocking.projects -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class CommitServiceTest { @Test fun callList() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val commitService = client.projects().commits() - val projectCommitListResponse = commitService.list(ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .page(123L) - .perPage(100L) - .build()) - println(projectCommitListResponse) - projectCommitListResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitService = client.projects().commits() + val projectCommitListResponse = + commitService.list( + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + ) + println(projectCommitListResponse) + projectCommitListResponse.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 d4c9e89..ed1ee7c 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 @@ -2,60 +2,53 @@ package com.openlayer.api.services.blocking.projects -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest { @Test fun callCreate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineCreateResponse = inferencePipelineService.create(ProjectInferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .description("This pipeline is used for production.") - .name("production") - .build()) - println(projectInferencePipelineCreateResponse) - projectInferencePipelineCreateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineCreateResponse = + inferencePipelineService.create( + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() + ) + println(projectInferencePipelineCreateResponse) + projectInferencePipelineCreateResponse.validate() } @Test fun callList() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineListResponse = inferencePipelineService.list(ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build()) - println(projectInferencePipelineListResponse) - projectInferencePipelineListResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineListResponse = + inferencePipelineService.list( + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() + ) + println(projectInferencePipelineListResponse) + projectInferencePipelineListResponse.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 db0e2e3..558cb7c 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 @@ -2,41 +2,28 @@ package com.openlayer.api.services.blocking.storage -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class PresignedUrlServiceTest { @Test fun callCreate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val presignedUrlService = client.storage().presignedUrl() - val storagePresignedUrlCreateResponse = presignedUrlService.create(StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build()) - println(storagePresignedUrlCreateResponse) - storagePresignedUrlCreateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlService = client.storage().presignedUrl() + val storagePresignedUrlCreateResponse = + presignedUrlService.create( + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + ) + println(storagePresignedUrlCreateResponse) + storagePresignedUrlCreateResponse.validate() } } From 656bca961e35da983260b1f6e5b3117d97bfebcf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:28:14 +0000 Subject: [PATCH 16/21] feat(api): update via SDK Studio (#23) --- .stats.yml | 2 +- .../models/InferencePipelineDeleteParams.kt | 159 +++++ .../models/InferencePipelineRetrieveParams.kt | 154 +++++ .../InferencePipelineRetrieveResponse.kt | 612 ++++++++++++++++++ .../async/InferencePipelineServiceAsync.kt | 19 + .../InferencePipelineServiceAsyncImpl.kt | 64 ++ .../blocking/InferencePipelineService.kt | 18 + .../blocking/InferencePipelineServiceImpl.kt | 58 ++ .../InferencePipelineDeleteParamsTest.kt | 30 + .../InferencePipelineRetrieveParamsTest.kt | 30 + .../InferencePipelineRetrieveResponseTest.kt | 71 ++ .../blocking/InferencePipelineServiceTest.kt | 39 +- 12 files changed, 1254 insertions(+), 2 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt diff --git a/.stats.yml b/.stats.yml index af63a6f..6ecfe8d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 10 +configured_endpoints: 12 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 new file mode 100644 index 0000000..623bef1 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -0,0 +1,159 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineDeleteParams +constructor( + private val inferencePipelineId: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + @JvmSynthetic + internal fun getBody(): Optional> { + return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDeleteParams && + this.inferencePipelineId == other.inferencePipelineId && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineDeleteParams{inferencePipelineId=$inferencePipelineId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineDeleteParams: InferencePipelineDeleteParams) = apply { + this.inferencePipelineId = inferencePipelineDeleteParams.inferencePipelineId + additionalQueryParams(inferencePipelineDeleteParams.additionalQueryParams) + additionalHeaders(inferencePipelineDeleteParams.additionalHeaders) + additionalBodyProperties(inferencePipelineDeleteParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineDeleteParams = + InferencePipelineDeleteParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..1b2409f --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects + +class InferencePipelineRetrieveParams +constructor( + private val inferencePipelineId: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineRetrieveParams && + this.inferencePipelineId == other.inferencePipelineId && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineRetrieveParams{inferencePipelineId=$inferencePipelineId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineRetrieveParams: InferencePipelineRetrieveParams) = + apply { + this.inferencePipelineId = inferencePipelineRetrieveParams.inferencePipelineId + additionalQueryParams(inferencePipelineRetrieveParams.additionalQueryParams) + additionalHeaders(inferencePipelineRetrieveParams.additionalHeaders) + additionalBodyProperties(inferencePipelineRetrieveParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineRetrieveParams = + InferencePipelineRetrieveParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..95ec229 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -0,0 +1,612 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = InferencePipelineRetrieveResponse.Builder::class) +@NoAutoDetect +class InferencePipelineRetrieveResponse +private constructor( + private val id: JsonField, + private val projectId: 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, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** 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 data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** 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 next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** 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 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")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** 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") + @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 + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineRetrieveResponse = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineRetrieveResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineRetrieveResponse{id=$id, projectId=$projectId, 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: 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 additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineRetrieveResponse: InferencePipelineRetrieveResponse) = + apply { + this.id = inferencePipelineRetrieveResponse.id + this.projectId = inferencePipelineRetrieveResponse.projectId + 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) + } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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.of(description)) + + /** 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 last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** 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 total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** 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)) + + /** 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)) + + @JsonProperty("links") + @ExcludeMissing + fun links(links: JsonField) = apply { this.links = links } + + 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(): InferencePipelineRetrieveResponse = + InferencePipelineRetrieveResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 b4419d4..59d093a 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 @@ -4,9 +4,14 @@ package com.openlayer.api.services.async +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDeleteParams +import com.openlayer.api.models.InferencePipelineRetrieveParams +import com.openlayer.api.models.InferencePipelineRetrieveResponse 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 { @@ -15,4 +20,18 @@ interface InferencePipelineServiceAsync { fun rows(): RowServiceAsync fun testResults(): TestResultServiceAsync + + /** Retrieve inference pipeline. */ + @JvmOverloads + fun retrieve( + params: InferencePipelineRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** Delete inference pipeline. */ + @JvmOverloads + 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 5518aff..04568a9 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,15 +3,26 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDeleteParams +import com.openlayer.api.models.InferencePipelineRetrieveParams +import com.openlayer.api.models.InferencePipelineRetrieveResponse 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.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl constructor( @@ -33,4 +44,57 @@ constructor( 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)) + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { retrieveHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) + + /** Delete inference pipeline. */ + override fun delete( + params: InferencePipelineDeleteParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response.use { deleteHandler.handle(it) } + } + } } 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 157d71f..259e545 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 @@ -4,6 +4,10 @@ package com.openlayer.api.services.blocking +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDeleteParams +import com.openlayer.api.models.InferencePipelineRetrieveParams +import com.openlayer.api.models.InferencePipelineRetrieveResponse import com.openlayer.api.services.blocking.inferencePipelines.DataService import com.openlayer.api.services.blocking.inferencePipelines.RowService import com.openlayer.api.services.blocking.inferencePipelines.TestResultService @@ -15,4 +19,18 @@ interface InferencePipelineService { fun rows(): RowService fun testResults(): TestResultService + + /** Retrieve inference pipeline. */ + @JvmOverloads + fun retrieve( + params: InferencePipelineRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none() + ): InferencePipelineRetrieveResponse + + /** Delete inference pipeline. */ + @JvmOverloads + fun delete( + params: InferencePipelineDeleteParams, + 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 2267d4a..2771de7 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,15 +3,25 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +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.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDeleteParams +import com.openlayer.api.models.InferencePipelineRetrieveParams +import com.openlayer.api.models.InferencePipelineRetrieveResponse 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.services.emptyHandler import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class InferencePipelineServiceImpl constructor( @@ -31,4 +41,52 @@ constructor( 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)) + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { retrieveHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) + + /** Delete inference pipeline. */ + override fun delete(params: InferencePipelineDeleteParams, requestOptions: RequestOptions) { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + clientOptions.httpClient.execute(request, requestOptions).let { response -> + response.use { deleteHandler.handle(it) } + } + } } 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 new file mode 100644 index 0000000..8ee3a33 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineDeleteParamsTest { + + @Test + fun createInferencePipelineDeleteParams() { + InferencePipelineDeleteParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun getPathParam() { + 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") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} 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 new file mode 100644 index 0000000..663b546 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineRetrieveParamsTest { + + @Test + fun createInferencePipelineRetrieveParams() { + InferencePipelineRetrieveParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .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/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt new file mode 100644 index 0000000..e259f06 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt @@ -0,0 +1,71 @@ +// 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 InferencePipelineRetrieveResponseTest { + + @Test + fun createInferencePipelineRetrieveResponse() { + 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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineRetrieveResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + assertThat(inferencePipelineRetrieveResponse).isNotNull + assertThat(inferencePipelineRetrieveResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(inferencePipelineRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineRetrieveResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineRetrieveResponse.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineRetrieveResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineRetrieveResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineRetrieveResponse.description()) + .contains("This pipeline is used for production.") + assertThat(inferencePipelineRetrieveResponse.failingGoalCount()).isEqualTo(123L) + assertThat(inferencePipelineRetrieveResponse.links()) + .isEqualTo( + InferencePipelineRetrieveResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(inferencePipelineRetrieveResponse.name()).isEqualTo("production") + assertThat(inferencePipelineRetrieveResponse.passingGoalCount()).isEqualTo(123L) + assertThat(inferencePipelineRetrieveResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(inferencePipelineRetrieveResponse.status()) + .isEqualTo(InferencePipelineRetrieveResponse.Status.QUEUED) + assertThat(inferencePipelineRetrieveResponse.statusMessage()) + .contains("Tests successfully evaluated") + assertThat(inferencePipelineRetrieveResponse.totalGoalCount()).isEqualTo(123L) + } +} 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 af33b2f..679b32c 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 @@ -3,7 +3,44 @@ package com.openlayer.api.services.blocking import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceTest { + + @Test + fun callRetrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.inferencePipelines() + val inferencePipelineRetrieveResponse = + inferencePipelineService.retrieve( + InferencePipelineRetrieveParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + println(inferencePipelineRetrieveResponse) + inferencePipelineRetrieveResponse.validate() + } + + @Test + fun callDelete() { + 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") + .build() + ) + } +} From 1166c1beeda0ba4d25c01820cd3646c14555491c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:38:16 +0000 Subject: [PATCH 17/21] feat(api): update via SDK Studio (#24) --- .stats.yml | 2 +- .../models/InferencePipelineUpdateParams.kt | 326 ++++++++++ .../models/InferencePipelineUpdateResponse.kt | 611 ++++++++++++++++++ .../async/InferencePipelineServiceAsync.kt | 9 + .../InferencePipelineServiceAsyncImpl.kt | 33 + .../blocking/InferencePipelineService.kt | 9 + .../blocking/InferencePipelineServiceImpl.kt | 32 + .../InferencePipelineUpdateParamsTest.kt | 59 ++ .../InferencePipelineUpdateResponseTest.kt | 71 ++ .../blocking/InferencePipelineServiceTest.kt | 21 + 10 files changed, 1172 insertions(+), 1 deletion(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 6ecfe8d..6a8c142 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 12 +configured_endpoints: 13 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 new file mode 100644 index 0000000..66bece6 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -0,0 +1,326 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineUpdateParams +constructor( + private val inferencePipelineId: String, + private val description: String?, + private val name: String?, + private val referenceDatasetUri: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + fun description(): Optional = Optional.ofNullable(description) + + fun name(): Optional = Optional.ofNullable(name) + + fun referenceDatasetUri(): Optional = Optional.ofNullable(referenceDatasetUri) + + @JvmSynthetic + internal fun getBody(): InferencePipelineUpdateBody { + return InferencePipelineUpdateBody( + description, + name, + referenceDatasetUri, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + @JsonDeserialize(builder = InferencePipelineUpdateBody.Builder::class) + @NoAutoDetect + class InferencePipelineUpdateBody + internal constructor( + private val description: String?, + private val name: String?, + private val referenceDatasetUri: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The inference pipeline description. */ + @JsonProperty("description") fun description(): String? = description + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(): String? = 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 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineUpdateBody && + this.description == other.description && + this.name == other.name && + this.referenceDatasetUri == other.referenceDatasetUri && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + description, + name, + referenceDatasetUri, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineUpdateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var description: String? = null + private var name: String? = null + private var referenceDatasetUri: String? = null + 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) + } + + /** The inference pipeline description. */ + @JsonProperty("description") + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(name: String) = 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 { + this.referenceDatasetUri = referenceDatasetUri + } + + 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(): InferencePipelineUpdateBody = + InferencePipelineUpdateBody( + description, + name, + referenceDatasetUri, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineUpdateParams && + this.inferencePipelineId == other.inferencePipelineId && + this.description == other.description && + this.name == other.name && + this.referenceDatasetUri == other.referenceDatasetUri && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + description, + name, + referenceDatasetUri, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineUpdateParams{inferencePipelineId=$inferencePipelineId, description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var description: String? = null + private var name: String? = null + private var referenceDatasetUri: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineUpdateParams: InferencePipelineUpdateParams) = apply { + this.inferencePipelineId = inferencePipelineUpdateParams.inferencePipelineId + this.description = inferencePipelineUpdateParams.description + this.name = inferencePipelineUpdateParams.name + this.referenceDatasetUri = inferencePipelineUpdateParams.referenceDatasetUri + additionalQueryParams(inferencePipelineUpdateParams.additionalQueryParams) + additionalHeaders(inferencePipelineUpdateParams.additionalHeaders) + additionalBodyProperties(inferencePipelineUpdateParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** The inference pipeline description. */ + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + fun name(name: String) = 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) = apply { + this.referenceDatasetUri = referenceDatasetUri + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): InferencePipelineUpdateParams = + InferencePipelineUpdateParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + description, + name, + referenceDatasetUri, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..3e7d741 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -0,0 +1,611 @@ +// 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.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.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = InferencePipelineUpdateResponse.Builder::class) +@NoAutoDetect +class InferencePipelineUpdateResponse +private constructor( + private val id: JsonField, + private val projectId: 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, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** 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 data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** 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 next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** 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 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")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** 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") + @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 + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineUpdateResponse = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineUpdateResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineUpdateResponse{id=$id, projectId=$projectId, 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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: 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 additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineUpdateResponse: InferencePipelineUpdateResponse) = + apply { + this.id = inferencePipelineUpdateResponse.id + this.projectId = inferencePipelineUpdateResponse.projectId + 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) + } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** 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 + } + + /** 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.of(description)) + + /** 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 last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** 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 total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** 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)) + + /** 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)) + + @JsonProperty("links") + @ExcludeMissing + fun links(links: JsonField) = apply { this.links = links } + + 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(): InferencePipelineUpdateResponse = + InferencePipelineUpdateResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app() = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Links = apply { + if (!validated) { + app() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var app: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + this.app = links.app + additionalProperties(links.additionalProperties) + } + + 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) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + } + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val QUEUED = Status(JsonField.of("queued")) + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PAUSED = Status(JsonField.of("paused")) + + @JvmField val FAILED = Status(JsonField.of("failed")) + + @JvmField val COMPLETED = Status(JsonField.of("completed")) + + @JvmField val UNKNOWN = Status(JsonField.of("unknown")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + _UNKNOWN, + } + + 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 + } + + 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") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 59d093a..84e6d9a 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 @@ -8,6 +8,8 @@ import com.openlayer.api.core.RequestOptions 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 @@ -28,6 +30,13 @@ interface InferencePipelineServiceAsync { requestOptions: RequestOptions = RequestOptions.none() ): CompletableFuture + /** Update inference pipeline. */ + @JvmOverloads + fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + /** Delete inference pipeline. */ @JvmOverloads fun delete( 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 04568a9..c5fd091 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 @@ -11,6 +11,8 @@ 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 @@ -75,6 +77,37 @@ constructor( } } + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update inference pipeline. */ + override fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) /** Delete inference pipeline. */ 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 259e545..8b22b53 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 @@ -8,6 +8,8 @@ import com.openlayer.api.core.RequestOptions 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 @@ -27,6 +29,13 @@ interface InferencePipelineService { requestOptions: RequestOptions = RequestOptions.none() ): InferencePipelineRetrieveResponse + /** Update inference pipeline. */ + @JvmOverloads + fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): InferencePipelineUpdateResponse + /** Delete inference pipeline. */ @JvmOverloads fun delete( 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 2771de7..efc4fb6 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 @@ -11,6 +11,8 @@ 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 @@ -71,6 +73,36 @@ constructor( } } + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update inference pipeline. */ + override fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions + ): InferencePipelineUpdateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) /** Delete inference pipeline. */ 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 new file mode 100644 index 0000000..ffecf85 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineUpdateParamsTest { + + @Test + fun createInferencePipelineUpdateParams() { + InferencePipelineUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("referenceDatasetUri") + .build() + } + + @Test + fun getBody() { + val params = + InferencePipelineUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("referenceDatasetUri") + .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") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + InferencePipelineUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val body = params.getBody() + assertThat(body).isNotNull + } + + @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/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt new file mode 100644 index 0000000..35af791 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt @@ -0,0 +1,71 @@ +// 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 InferencePipelineUpdateResponseTest { + + @Test + fun createInferencePipelineUpdateResponse() { + 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(123L) + .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(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineUpdateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + assertThat(inferencePipelineUpdateResponse).isNotNull + assertThat(inferencePipelineUpdateResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(inferencePipelineUpdateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineUpdateResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineUpdateResponse.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineUpdateResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineUpdateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(inferencePipelineUpdateResponse.description()) + .contains("This pipeline is used for production.") + assertThat(inferencePipelineUpdateResponse.failingGoalCount()).isEqualTo(123L) + assertThat(inferencePipelineUpdateResponse.links()) + .isEqualTo( + InferencePipelineUpdateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(inferencePipelineUpdateResponse.name()).isEqualTo("production") + assertThat(inferencePipelineUpdateResponse.passingGoalCount()).isEqualTo(123L) + assertThat(inferencePipelineUpdateResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(inferencePipelineUpdateResponse.status()) + .isEqualTo(InferencePipelineUpdateResponse.Status.QUEUED) + assertThat(inferencePipelineUpdateResponse.statusMessage()) + .contains("Tests successfully evaluated") + assertThat(inferencePipelineUpdateResponse.totalGoalCount()).isEqualTo(123L) + } +} 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 679b32c..d4ca7e1 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 @@ -29,6 +29,27 @@ class InferencePipelineServiceTest { inferencePipelineRetrieveResponse.validate() } + @Test + fun callUpdate() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.inferencePipelines() + val inferencePipelineUpdateResponse = + inferencePipelineService.update( + InferencePipelineUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("referenceDatasetUri") + .build() + ) + println(inferencePipelineUpdateResponse) + inferencePipelineUpdateResponse.validate() + } + @Test fun callDelete() { val client = From 67bc5ea91b7b482e09c8e4ccbbd544185e221a10 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:36:23 +0000 Subject: [PATCH 18/21] chore(tests): update prism version (#25) --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index fe89a1d..f586157 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" fi From a309673d5c7e72df8b006156d5458570d251995e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:37:37 +0000 Subject: [PATCH 19/21] chore(internal): restore release-please configuration files (#26) --- .github/workflows/publish-sonatype.yml | 39 +++++++++++++++ .github/workflows/release-doctor.yml | 25 ++++++++++ .release-please-manifest.json | 3 ++ bin/check-release-environment | 33 +++++++++++++ build.gradle.kts | 2 +- release-please-config.json | 67 ++++++++++++++++++++++++++ 6 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-sonatype.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .release-please-manifest.json create mode 100644 bin/check-release-environment create mode 100644 release-please-config.json diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml new file mode 100644 index 0000000..7dd499b --- /dev/null +++ b/.github/workflows/publish-sonatype.yml @@ -0,0 +1,39 @@ +# 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 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: | + 8 + 17 + cache: gradle + + - name: Set up Gradle + uses: gradle/gradle-build-action@v2 + + - name: Publish to Sonatype + 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 }} \ No newline at end of file diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..7a3754c --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,25 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + 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: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + 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/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..ba6c348 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0-alpha.1" +} \ No newline at end of file diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..14a9e4d --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +errors=() + +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 + +if [ -z "${SONATYPE_PASSWORD}" ]; then + errors+=("The OPENLAYER_SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +if [ -z "${GPG_SIGNING_KEY}" ]; then + errors+=("The OPENLAYER_SONATYPE_GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +if [ -z "${GPG_SIGNING_PASSWORD}" ]; then + errors+=("The OPENLAYER_SONATYPE_GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/build.gradle.kts b/build.gradle.kts index 795fbd7..1f51e8e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.openlayer.api" - version = "0.1.0-alpha.1" + version = "0.1.0-alpha.1" // x-release-please-version } nexusPublishing { diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..8f98719 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "simple", + "extra-files": [ + "README.md", + "build.gradle.kts" + ] +} \ No newline at end of file From 9ed736f97e978d70402de098e6ba131057e0d080 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:59:50 +0000 Subject: [PATCH 20/21] feat(api): update via SDK Studio (#27) --- .github/workflows/ci.yml | 1 + .github/workflows/publish-sonatype.yml | 2 +- build.gradle.kts | 12 +-- buildSrc/build.gradle.kts | 4 + .../src/main/kotlin/openlayer.java.gradle.kts | 14 +--- .../main/kotlin/openlayer.kotlin.gradle.kts | 1 + .../main/kotlin/openlayer.publish.gradle.kts | 83 ++++++++----------- .../api/core/http/BinaryResponseContent.kt | 7 +- .../com/openlayer/api/core/http/HttpClient.kt | 4 +- .../api/core/http/HttpRequestBody.kt | 4 +- .../openlayer/api/core/http/HttpResponse.kt | 4 +- .../com/openlayer/api/services/Handlers.kt | 35 +++----- .../api/client/OpenlayerClientTest.kt | 5 -- scripts/mock | 4 +- 14 files changed, 72 insertions(+), 108 deletions(-) delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 008e387..b5c77a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,3 +35,4 @@ jobs: - name: Run lints run: ./scripts/lint + diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 7dd499b..fbc52d2 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -30,7 +30,7 @@ jobs: - name: Publish to Sonatype run: | - ./gradlew --parallel --no-daemon publish + ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" env: SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/build.gradle.kts b/build.gradle.kts index 1f51e8e..206e0f3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" + } allprojects { @@ -7,14 +7,4 @@ allprojects { version = "0.1.0-alpha.1" // x-release-please-version } -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - username.set(System.getenv("SONATYPE_USERNAME")) - password.set(System.getenv("SONATYPE_PASSWORD")) - } - } -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b88cd06..493cb32 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,12 +1,16 @@ plugins { `kotlin-dsl` + kotlin("jvm") version "1.9.22" + id("com.vanniktech.maven.publish") version "0.28.0" } repositories { gradlePluginPortal() + mavenCentral() } dependencies { implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") + 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 bc01a1d..53e6330 100644 --- a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts @@ -1,6 +1,9 @@ import com.diffplug.gradle.spotless.SpotlessExtension import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import java.util.Locale +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` @@ -11,11 +14,6 @@ repositories { mavenCentral() } -configure { - withJavadocJar() - withSourcesJar() -} - configure { java { importOrder() @@ -35,10 +33,6 @@ tasks.withType().configureEach { options.release.set(8) } -tasks.named("javadocJar") { - setZip64(true) -} - tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index d5a6d5d..5c12826 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -1,5 +1,6 @@ import com.diffplug.gradle.spotless.SpotlessExtension import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import com.vanniktech.maven.publish.* plugins { id("openlayer.java") diff --git a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts index 1179c4d..d159a4f 100644 --- a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts @@ -3,65 +3,52 @@ 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 plugins { - `maven-publish` - `signing` + id("com.vanniktech.maven.publish") } -configure { - publications { - register("maven") { - from(components["java"]) +repositories { + gradlePluginPortal() + mavenCentral() +} - pom { - name.set("Openlayer API") - description.set("API for interacting with the Openlayer server.") - url.set("https://openlayer.com/docs/api-reference/rest/overview") +extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") +extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") +extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") - licenses { - license { - name.set("Apache-2.0") - } - } +configure { + signAllPublications() + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) - developers { - developer { - name.set("Openlayer") - email.set("support@openlayer.com") - } - } + this.coordinates(project.group.toString(), project.name, project.version.toString()) - scm { - connection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") - developerConnection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") - url.set("https://github.com/openlayer-ai/openlayer-java") - } + pom { + name.set("Openlayer API") + description.set("API for interacting with the Openlayer server.") + url.set("https://openlayer.com/docs/api-reference/rest/overview") - versionMapping { - allVariants { - fromResolutionResult() - } - } + licenses { + license { + name.set("Apache-2.0") } } - } -} -signing { - val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } - val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } - val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } - if (signingKey != null && signingPassword != null) { - useInMemoryPgpKeys( - signingKeyId, - signingKey, - signingPassword, - ) - sign(publishing.publications["maven"]) - } -} + developers { + developer { + name.set("Openlayer") + email.set("support@openlayer.com") + } + } -tasks.named("publish") { - dependsOn(":closeAndReleaseSonatypeStagingRepository") + scm { + connection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") + developerConnection.set("scm:git:git://github.com/openlayer-ai/openlayer-java.git") + url.set("https://github.com/openlayer-ai/openlayer-java") + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt index 4c099ff..79dd3d8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt @@ -1,13 +1,14 @@ package com.openlayer.api.core.http -import java.io.Closeable import java.io.IOException import java.io.InputStream import java.io.OutputStream +import java.lang.AutoCloseable +import java.util.Optional -interface BinaryResponseContent : Closeable { +interface BinaryResponseContent : AutoCloseable { - fun contentType(): String? + fun contentType(): Optional fun body(): InputStream 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 b9cac17..e6fb4bc 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,10 +1,10 @@ package com.openlayer.api.core.http import com.openlayer.api.core.RequestOptions -import java.io.Closeable +import java.lang.AutoCloseable import java.util.concurrent.CompletableFuture -interface HttpClient : Closeable { +interface HttpClient : AutoCloseable { fun execute( request: HttpRequest, 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 4f4dbd1..32b5f81 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,10 +1,10 @@ package com.openlayer.api.core.http -import java.io.Closeable import java.io.IOException import java.io.OutputStream +import java.lang.AutoCloseable -interface HttpRequestBody : Closeable { +interface HttpRequestBody : AutoCloseable { @Throws(IOException::class) fun writeTo(outputStream: OutputStream) 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 c4c2f92..5c5f3ce 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,10 +1,10 @@ package com.openlayer.api.core.http import com.google.common.collect.ListMultimap -import java.io.Closeable import java.io.InputStream +import java.lang.AutoCloseable -interface HttpResponse : Closeable { +interface HttpResponse : AutoCloseable { fun statusCode(): Int diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt index 357020c..4d849f4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt @@ -19,6 +19,7 @@ import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException import java.io.InputStream import java.io.OutputStream +import java.util.Optional @JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandler @@ -38,7 +39,18 @@ private object StringHandler : Handler { private object BinaryHandler : Handler { override fun handle(response: HttpResponse): BinaryResponseContent { - return BinaryResponseContentImpl(response) + return object : BinaryResponseContent { + override fun contentType(): Optional = + Optional.ofNullable(response.headers().get("Content-Type").firstOrNull()) + + override fun body(): InputStream = response.body() + + override fun close() = response.close() + + override fun writeTo(outputStream: OutputStream) { + response.body().copyTo(outputStream) + } + } } } @@ -107,24 +119,3 @@ internal fun Handler.withErrorHandler(errorHandler: Handler Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" fi From 0fc8cd4e45513b72a1c62a82b6b6678fa400313e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 03:12:40 +0000 Subject: [PATCH 21/21] release: 0.1.0-alpha.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ README.md | 6 +++--- build.gradle.kts | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ba6c348..f14b480 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.1" + ".": "0.1.0-alpha.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9398600..beede32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## 0.1.0-alpha.2 (2024-08-15) + +Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/openlayer-ai/openlayer-java/compare/v0.1.0-alpha.1...v0.1.0-alpha.2) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([f3a2e94](https://github.com/openlayer-ai/openlayer-java/commit/f3a2e94096f7065baaf412330b4d82098144a7c6)) +* **api:** OpenAPI spec update via Stainless API ([#13](https://github.com/openlayer-ai/openlayer-java/issues/13)) ([3d51770](https://github.com/openlayer-ai/openlayer-java/commit/3d51770cd80a882159c7bd267ebb4b1f82e1bbf2)) +* **api:** OpenAPI spec update via Stainless API ([#16](https://github.com/openlayer-ai/openlayer-java/issues/16)) ([700e5dd](https://github.com/openlayer-ai/openlayer-java/commit/700e5dd17a46e547f1a2433993bbb4b586ae2159)) +* **api:** OpenAPI spec update via Stainless API ([#22](https://github.com/openlayer-ai/openlayer-java/issues/22)) ([57cd9b9](https://github.com/openlayer-ai/openlayer-java/commit/57cd9b93d5cc5a955a2ca30136e53fcbc0db3fe1)) +* **api:** OpenAPI spec update via Stainless API ([#8](https://github.com/openlayer-ai/openlayer-java/issues/8)) ([8edaa4b](https://github.com/openlayer-ai/openlayer-java/commit/8edaa4b24bf2b90d987ed7f64d2f789016f0f2ef)) +* **api:** OpenAPI spec update via Stainless API ([#9](https://github.com/openlayer-ai/openlayer-java/issues/9)) ([69c5aba](https://github.com/openlayer-ai/openlayer-java/commit/69c5aba6d450e4a924a1ec1bf8f427cd66ba29a0)) +* **api:** update via SDK Studio ([#10](https://github.com/openlayer-ai/openlayer-java/issues/10)) ([75a4d98](https://github.com/openlayer-ai/openlayer-java/commit/75a4d984832a11a4561b7b45ef1667dad6e8bd0a)) +* **api:** update via SDK Studio ([#14](https://github.com/openlayer-ai/openlayer-java/issues/14)) ([b5ecd1c](https://github.com/openlayer-ai/openlayer-java/commit/b5ecd1cffeec8cc90c8fc37eb86d270671adcc73)) +* **api:** update via SDK Studio ([#15](https://github.com/openlayer-ai/openlayer-java/issues/15)) ([ca3563b](https://github.com/openlayer-ai/openlayer-java/commit/ca3563b438c684f30bdc57fe95bd0bee33a0b201)) +* **api:** update via SDK Studio ([#21](https://github.com/openlayer-ai/openlayer-java/issues/21)) ([b3df178](https://github.com/openlayer-ai/openlayer-java/commit/b3df178a8dba68759f3e9146c32ab2b52afa07a4)) +* **api:** update via SDK Studio ([#23](https://github.com/openlayer-ai/openlayer-java/issues/23)) ([656bca9](https://github.com/openlayer-ai/openlayer-java/commit/656bca961e35da983260b1f6e5b3117d97bfebcf)) +* **api:** update via SDK Studio ([#24](https://github.com/openlayer-ai/openlayer-java/issues/24)) ([1166c1b](https://github.com/openlayer-ai/openlayer-java/commit/1166c1beeda0ba4d25c01820cd3646c14555491c)) +* **api:** update via SDK Studio ([#27](https://github.com/openlayer-ai/openlayer-java/issues/27)) ([9ed736f](https://github.com/openlayer-ai/openlayer-java/commit/9ed736f97e978d70402de098e6ba131057e0d080)) +* **api:** update via SDK Studio ([#5](https://github.com/openlayer-ai/openlayer-java/issues/5)) ([f01f468](https://github.com/openlayer-ai/openlayer-java/commit/f01f468c2b6a0521a5f67bf7715d9d1e68eab49c)) +* **api:** update via SDK Studio ([#7](https://github.com/openlayer-ai/openlayer-java/issues/7)) ([8c4398e](https://github.com/openlayer-ai/openlayer-java/commit/8c4398ed39212e1e018729727d7dfbe70a8db27d)) + + +### Chores + +* **ci:** limit release doctor target branches ([#17](https://github.com/openlayer-ai/openlayer-java/issues/17)) ([ef0d7e9](https://github.com/openlayer-ai/openlayer-java/commit/ef0d7e9c91d7798039e01600b762b13f1f5ada23)) +* go live ([#6](https://github.com/openlayer-ai/openlayer-java/issues/6)) ([30ba342](https://github.com/openlayer-ai/openlayer-java/commit/30ba3429a02384007ec45e95db462a07d6a8e892)) +* **internal:** codegen related update ([#18](https://github.com/openlayer-ai/openlayer-java/issues/18)) ([ff15d61](https://github.com/openlayer-ai/openlayer-java/commit/ff15d6179d277e41ab1910b69e90e49323530e3b)) +* **internal:** refactor release doctor script ([#19](https://github.com/openlayer-ai/openlayer-java/issues/19)) ([6ce88ff](https://github.com/openlayer-ai/openlayer-java/commit/6ce88ff0c6f47bc4ae9d64e97dfedccc98edc5f7)) +* **internal:** restore release-please configuration files ([#26](https://github.com/openlayer-ai/openlayer-java/issues/26)) ([a309673](https://github.com/openlayer-ai/openlayer-java/commit/a309673d5c7e72df8b006156d5458570d251995e)) +* **internal:** version bump ([#3](https://github.com/openlayer-ai/openlayer-java/issues/3)) ([2e46974](https://github.com/openlayer-ai/openlayer-java/commit/2e46974aefcd77a33417b3d675bea14ccb95befd)) +* **tests:** update prism version ([#25](https://github.com/openlayer-ai/openlayer-java/issues/25)) ([67bc5ea](https://github.com/openlayer-ai/openlayer-java/commit/67bc5ea91b7b482e09c8e4ccbbd544185e221a10)) + ## 0.1.0-alpha.1 (2024-06-24) Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/openlayer-ai/openlayer-java/compare/v0.0.1-alpha.0...v0.1.0-alpha.1) diff --git a/README.md b/README.md index 329fd2c..da1c440 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,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.1) +[![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.2) @@ -27,7 +27,7 @@ The REST API documentation can be foundĀ on [openlayer.com](https://openlayer.co ```kotlin -implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.1") +implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.2") ``` #### Maven @@ -36,7 +36,7 @@ implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.1") com.openlayer.api openlayer-java - 0.1.0-alpha.1 + 0.1.0-alpha.2 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 206e0f3..0e8d4a4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.openlayer.api" - version = "0.1.0-alpha.1" // x-release-please-version + version = "0.1.0-alpha.2" // x-release-please-version }