From 770d6bfd5d31bfe38c3395c57b9ea93a35065e8c Mon Sep 17 00:00:00 2001 From: Yong Date: Tue, 16 Jun 2026 11:02:56 -0700 Subject: [PATCH 1/7] Build SDK Stainless-Generated-From: c7f900105b62f0dc77c086dbdc38f16537bfc9aa --- .github/workflows/ci.yml | 42 +----------- .github/workflows/publish-sonatype.yml | 37 ++++++++++ .github/workflows/release-doctor.yml | 25 +++++++ .release-please-manifest.json | 3 + .stats.yml | 3 - README.md | 18 ++++- bin/check-release-environment | 37 ++++++++++ build.gradle.kts | 2 +- .../kotlin/llama-cloud.publish.gradle.kts | 6 +- .../com/llamacloud_prod/api/core/Check.kt | 2 +- release-please-config.json | 67 +++++++++++++++++++ 11 files changed, 191 insertions(+), 51 deletions(-) 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/ci.yml b/.github/workflows/ci.yml index 320d8d1..6833b49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: lint: timeout-minutes: 15 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/llamacloud-prod-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: @@ -45,7 +45,7 @@ jobs: permissions: contents: read id-token: write - runs-on: ${{ github.repository == 'stainless-sdks/llamacloud-prod-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: @@ -66,44 +66,6 @@ jobs: - name: Build SDK run: ./scripts/build - - name: Get GitHub OIDC Token - if: |- - github.repository == 'stainless-sdks/llamacloud-prod-java' && - !startsWith(github.ref, 'refs/heads/stl/') - id: github-oidc - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: core.setOutput('github_token', await core.getIDToken()); - - name: Build and upload Maven artifacts - if: |- - github.repository == 'stainless-sdks/llamacloud-prod-java' && - !startsWith(github.ref, 'refs/heads/stl/') - env: - URL: https://pkg.stainless.com/s - AUTH: ${{ steps.github-oidc.outputs.github_token }} - SHA: ${{ github.sha }} - PROJECT: llamacloud-prod-java - run: ./scripts/upload-artifacts - test: - timeout-minutes: 15 - name: test - runs-on: ${{ github.repository == 'stainless-sdks/llamacloud-prod-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Set up Java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 - with: - distribution: temurin - java-version: | - 8 - 21 - cache: gradle - - name: Set up Gradle - uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 - - name: Run tests - run: ./scripts/test diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml new file mode 100644 index 0000000..ac77d9e --- /dev/null +++ b/.github/workflows/publish-sonatype.yml @@ -0,0 +1,37 @@ +# 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/run-llama/llama-parse-java/actions/workflows/publish-sonatype.yml +name: Publish Sonatype +on: + workflow_dispatch: + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up Java + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 + with: + distribution: temurin + java-version: | + 8 + 21 + cache: gradle + + - name: Set up Gradle + uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 + + - name: Publish to Sonatype + run: |- + export -- GPG_SIGNING_KEY_ID + printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" + GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" + ./gradlew publish --no-configuration-cache + env: + SONATYPE_USERNAME: ${{ secrets.LLAMA_CLOUD_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.LLAMA_CLOUD_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} + GPG_SIGNING_KEY: ${{ secrets.LLAMA_CLOUD_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.LLAMA_CLOUD_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..a13fad8 --- /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 == 'run-llama/llama-parse-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} + SONATYPE_USERNAME: ${{ secrets.LLAMA_CLOUD_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.LLAMA_CLOUD_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} + GPG_SIGNING_KEY: ${{ secrets.LLAMA_CLOUD_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.LLAMA_CLOUD_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..1332969 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 561946d..97e2fbf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1 @@ configured_endpoints: 131 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamaindex-Georgehe4/llamacloud-prod-76b59acff99524099afaddec7a3d8cfebfd1ecc096e57284722bcd26b39e466e.yml -openapi_spec_hash: b52d9f7ba54524c4dd975fe53dd8e94e -config_hash: a65cacd5ca98538ef6f5e6ac330f25a9 diff --git a/README.md b/README.md index 421c85f..ef74309 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ # Llama Cloud Java API Library + + [![Maven Central](https://img.shields.io/maven-central/v/com.llamacloud_prod.api/llama-cloud-java)](https://central.sonatype.com/artifact/com.llamacloud_prod.api/llama-cloud-java/0.0.1) [![javadoc](https://javadoc.io/badge2/com.llamacloud_prod.api/llama-cloud-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.llamacloud_prod.api/llama-cloud-java/0.0.1) + + The Llama Cloud Java SDK provides convenient access to the [Llama Cloud REST API](https://developers.llamaindex.ai/) from applications written in Java. It is generated with [Stainless](https://www.stainless.com/). @@ -11,15 +15,21 @@ It is generated with [Stainless](https://www.stainless.com/). Use the Llama Cloud MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. -[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40llamaindex%2Fllama-cloud-mcp&config=eyJuYW1lIjoiQGxsYW1haW5kZXgvbGxhbWEtY2xvdWQtbWNwIiwidHJhbnNwb3J0IjoiaHR0cCIsInVybCI6Imh0dHBzOi8vbGxhbWFjbG91ZC1wcm9kLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtbGxhbWEtY2xvdWQtYXBpLWtleSI6Ik15IEFQSSBLZXkifX0) -[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40llamaindex%2Fllama-cloud-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fllamacloud-prod.stlmcp.com%22%2C%22headers%22%3A%7B%22x-llama-cloud-api-key%22%3A%22My%20API%20Key%22%7D%7D) +[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40llamaindex%2Fllama-cloud-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBsbGFtYWluZGV4L2xsYW1hLWNsb3VkLW1jcCJdLCJlbnYiOnsiTExBTUFfQ0xPVURfQVBJX0tFWSI6Ik15IEFQSSBLZXkifX0) +[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40llamaindex%2Fllama-cloud-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40llamaindex%2Fllama-cloud-mcp%22%5D%2C%22env%22%3A%7B%22LLAMA_CLOUD_API_KEY%22%3A%22My%20API%20Key%22%7D%7D) > Note: You may need to set environment variables in your MCP client. + + The REST API documentation can be found on [developers.llamaindex.ai](https://developers.llamaindex.ai/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.llamacloud_prod.api/llama-cloud-java/0.0.1). + + ## Installation + + ### Gradle ```kotlin @@ -36,6 +46,8 @@ implementation("com.llamacloud_prod.api:llama-cloud-java:0.0.1") ``` + + ## Requirements This library requires Java 8 or later. @@ -847,4 +859,4 @@ 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/stainless-sdks/llamacloud-prod-java/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/run-llama/llama-parse-java/issues) with questions, bugs, or suggestions. diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..273c639 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${RELEASE_PLEASE_TOKEN}" ]; then + errors+=("The RELEASE_PLEASE_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.") +fi + +if [ -z "${SONATYPE_USERNAME}" ]; then + errors+=("The 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 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 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 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 93a574f..ee10d9d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "com.llamacloud_prod.api" - version = "0.0.1" + version = "0.0.1" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/llama-cloud.publish.gradle.kts b/buildSrc/src/main/kotlin/llama-cloud.publish.gradle.kts index e3a8ddd..5a832fd 100644 --- a/buildSrc/src/main/kotlin/llama-cloud.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/llama-cloud.publish.gradle.kts @@ -26,9 +26,9 @@ configure { } scm { - connection.set("scm:git:git://github.com/stainless-sdks/llamacloud-prod-java.git") - developerConnection.set("scm:git:git://github.com/stainless-sdks/llamacloud-prod-java.git") - url.set("https://github.com/stainless-sdks/llamacloud-prod-java") + connection.set("scm:git:git://github.com/run-llama/llama-parse-java.git") + developerConnection.set("scm:git:git://github.com/run-llama/llama-parse-java.git") + url.set("https://github.com/run-llama/llama-parse-java") } versionMapping { diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/core/Check.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/core/Check.kt index 786aa6e..5c4255d 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/core/Check.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/core/Check.kt @@ -77,7 +77,7 @@ This can happen if you are either: Double-check that you are depending on compatible Jackson versions. -See https://www.github.com/stainless-sdks/llamacloud-prod-java#jackson for more information. +See https://www.github.com/run-llama/llama-parse-java#jackson for more information. """ .trimIndent() } diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..5550ca0 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/googleapis/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 4e254a7d25307499377d20d77a4c72ff862a9f4b Mon Sep 17 00:00:00 2001 From: Yong Date: Tue, 16 Jun 2026 11:14:16 -0700 Subject: [PATCH 2/7] Build SDK Stainless-Generated-From: 2f392441ce22633ca0ec07652def4738177e09be --- .../api/models/pipelines/MetadataFilters.kt | 101 ++++++++++-------- .../QuerySearchParams.kt} | 32 +++--- .../services/async/RetrieverServiceAsync.kt | 7 +- .../async/RetrieverServiceAsyncImpl.kt | 18 ++-- ...erServiceAsync.kt => QueryServiceAsync.kt} | 30 +++--- ...eAsyncImpl.kt => QueryServiceAsyncImpl.kt} | 24 ++--- .../api/services/blocking/RetrieverService.kt | 7 +- .../services/blocking/RetrieverServiceImpl.kt | 16 ++- .../{RetrieverService.kt => QueryService.kt} | 28 ++--- ...everServiceImpl.kt => QueryServiceImpl.kt} | 24 ++--- .../QuerySearchParamsTest.kt} | 16 +-- ...eAsyncTest.kt => QueryServiceAsyncTest.kt} | 10 +- ...everServiceTest.kt => QueryServiceTest.kt} | 10 +- 13 files changed, 161 insertions(+), 162 deletions(-) rename llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/{retriever/RetrieverSearchParams.kt => query/QuerySearchParams.kt} (96%) rename llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/{RetrieverServiceAsync.kt => QueryServiceAsync.kt} (78%) rename llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/{RetrieverServiceAsyncImpl.kt => QueryServiceAsyncImpl.kt} (82%) rename llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/{RetrieverService.kt => QueryService.kt} (76%) rename llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/{RetrieverServiceImpl.kt => QueryServiceImpl.kt} (82%) rename llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/{retriever/RetrieverSearchParamsTest.kt => query/QuerySearchParamsTest.kt} (90%) rename llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/{RetrieverServiceAsyncTest.kt => QueryServiceAsyncTest.kt} (82%) rename llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/{RetrieverServiceTest.kt => QueryServiceTest.kt} (82%) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/MetadataFilters.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/MetadataFilters.kt index 934b763..f8c3733 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/MetadataFilters.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/MetadataFilters.kt @@ -642,14 +642,17 @@ private constructor( /** Alias for calling [value] with `Value.ofString(string)`. */ fun value(string: String) = value(Value.ofString(string)) - /** Alias for calling [value] with `Value.ofStrings(strings)`. */ - fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + /** Alias for calling [value] with `Value.ofStringArray(stringArray)`. */ + fun valueOfStringArray(stringArray: List) = + value(Value.ofStringArray(stringArray)) - /** Alias for calling [value] with `Value.ofNumber(number)`. */ - fun valueOfNumber(number: List) = value(Value.ofNumber(number)) + /** Alias for calling [value] with `Value.ofNumberArray(numberArray)`. */ + fun valueOfNumberArray(numberArray: List) = + value(Value.ofNumberArray(numberArray)) - /** Alias for calling [value] with `Value.ofInteger(integer)`. */ - fun valueOfInteger(integer: List) = value(Value.ofInteger(integer)) + /** Alias for calling [value] with `Value.ofIntegerArray(integerArray)`. */ + fun valueOfIntegerArray(integerArray: List) = + value(Value.ofIntegerArray(integerArray)) /** Vector store filter operator. */ fun operator(operator: Operator) = operator(JsonField.of(operator)) @@ -756,9 +759,9 @@ private constructor( private constructor( private val number: Double? = null, private val string: String? = null, - private val strings: List? = null, - private val number: List? = null, - private val integer: List? = null, + private val stringArray: List? = null, + private val numberArray: List? = null, + private val integerArray: List? = null, private val _json: JsonValue? = null, ) { @@ -766,31 +769,31 @@ private constructor( fun string(): Optional = Optional.ofNullable(string) - fun strings(): Optional> = Optional.ofNullable(strings) + fun stringArray(): Optional> = Optional.ofNullable(stringArray) - fun number(): Optional> = Optional.ofNullable(number) + fun numberArray(): Optional> = Optional.ofNullable(numberArray) - fun integer(): Optional> = Optional.ofNullable(integer) + fun integerArray(): Optional> = Optional.ofNullable(integerArray) fun isNumber(): Boolean = number != null fun isString(): Boolean = string != null - fun isStrings(): Boolean = strings != null + fun isStringArray(): Boolean = stringArray != null - fun isNumber(): Boolean = number != null + fun isNumberArray(): Boolean = numberArray != null - fun isInteger(): Boolean = integer != null + fun isIntegerArray(): Boolean = integerArray != null fun asNumber(): Double = number.getOrThrow("number") fun asString(): String = string.getOrThrow("string") - fun asStrings(): List = strings.getOrThrow("strings") + fun asStringArray(): List = stringArray.getOrThrow("stringArray") - fun asNumber(): List = number.getOrThrow("number") + fun asNumberArray(): List = numberArray.getOrThrow("numberArray") - fun asInteger(): List = integer.getOrThrow("integer") + fun asIntegerArray(): List = integerArray.getOrThrow("integerArray") fun _json(): Optional = Optional.ofNullable(_json) @@ -828,9 +831,9 @@ private constructor( when { number != null -> visitor.visitNumber(number) string != null -> visitor.visitString(string) - strings != null -> visitor.visitStrings(strings) - number != null -> visitor.visitNumber(number) - integer != null -> visitor.visitInteger(integer) + stringArray != null -> visitor.visitStringArray(stringArray) + numberArray != null -> visitor.visitNumberArray(numberArray) + integerArray != null -> visitor.visitIntegerArray(integerArray) else -> visitor.unknown(_json) } @@ -857,11 +860,11 @@ private constructor( override fun visitString(string: String) {} - override fun visitStrings(strings: List) {} + override fun visitStringArray(stringArray: List) {} - override fun visitNumber(number: List) {} + override fun visitNumberArray(numberArray: List) {} - override fun visitInteger(integer: List) {} + override fun visitIntegerArray(integerArray: List) {} } ) validated = true @@ -889,11 +892,14 @@ private constructor( override fun visitString(string: String) = 1 - override fun visitStrings(strings: List) = strings.size + override fun visitStringArray(stringArray: List) = + stringArray.size - override fun visitNumber(number: List) = number.size + override fun visitNumberArray(numberArray: List) = + numberArray.size - override fun visitInteger(integer: List) = integer.size + override fun visitIntegerArray(integerArray: List) = + integerArray.size override fun unknown(json: JsonValue?) = 0 } @@ -907,21 +913,21 @@ private constructor( return other is Value && number == other.number && string == other.string && - strings == other.strings && - number == other.number && - integer == other.integer + stringArray == other.stringArray && + numberArray == other.numberArray && + integerArray == other.integerArray } override fun hashCode(): Int = - Objects.hash(number, string, strings, number, integer) + Objects.hash(number, string, stringArray, numberArray, integerArray) override fun toString(): String = when { number != null -> "Value{number=$number}" string != null -> "Value{string=$string}" - strings != null -> "Value{strings=$strings}" - number != null -> "Value{number=$number}" - integer != null -> "Value{integer=$integer}" + stringArray != null -> "Value{stringArray=$stringArray}" + numberArray != null -> "Value{numberArray=$numberArray}" + integerArray != null -> "Value{integerArray=$integerArray}" _json != null -> "Value{_unknown=$_json}" else -> throw IllegalStateException("Invalid Value") } @@ -933,13 +939,16 @@ private constructor( @JvmStatic fun ofString(string: String) = Value(string = string) @JvmStatic - fun ofStrings(strings: List) = Value(strings = strings.toImmutable()) + fun ofStringArray(stringArray: List) = + Value(stringArray = stringArray.toImmutable()) @JvmStatic - fun ofNumber(number: List) = Value(number = number.toImmutable()) + fun ofNumberArray(numberArray: List) = + Value(numberArray = numberArray.toImmutable()) @JvmStatic - fun ofInteger(integer: List) = Value(integer = integer.toImmutable()) + fun ofIntegerArray(integerArray: List) = + Value(integerArray = integerArray.toImmutable()) } /** @@ -952,11 +961,11 @@ private constructor( fun visitString(string: String): T - fun visitStrings(strings: List): T + fun visitStringArray(stringArray: List): T - fun visitNumber(number: List): T + fun visitNumberArray(numberArray: List): T - fun visitInteger(integer: List): T + fun visitIntegerArray(integerArray: List): T /** * Maps an unknown variant of [Value] to a value of type [T]. @@ -987,13 +996,13 @@ private constructor( Value(number = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>())?.let { - Value(strings = it, _json = json) + Value(stringArray = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>())?.let { - Value(number = it, _json = json) + Value(numberArray = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>())?.let { - Value(integer = it, _json = json) + Value(integerArray = it, _json = json) }, ) .filterNotNull() @@ -1023,9 +1032,9 @@ private constructor( when { value.number != null -> generator.writeObject(value.number) value.string != null -> generator.writeObject(value.string) - value.strings != null -> generator.writeObject(value.strings) - value.number != null -> generator.writeObject(value.number) - value.integer != null -> generator.writeObject(value.integer) + value.stringArray != null -> generator.writeObject(value.stringArray) + value.numberArray != null -> generator.writeObject(value.numberArray) + value.integerArray != null -> generator.writeObject(value.integerArray) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/retriever/RetrieverSearchParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/query/QuerySearchParams.kt similarity index 96% rename from llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/retriever/RetrieverSearchParams.kt rename to llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/query/QuerySearchParams.kt index a816186..38e959c 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/retriever/RetrieverSearchParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/retrievers/query/QuerySearchParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.llamacloud_prod.api.models.retrievers.retriever +package com.llamacloud_prod.api.models.retrievers.query import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -23,7 +23,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Retrieve data using a Retriever. */ -class RetrieverSearchParams +class QuerySearchParams private constructor( private val retrieverId: String?, private val organizationId: String?, @@ -113,7 +113,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [RetrieverSearchParams]. + * Returns a mutable builder for constructing an instance of [QuerySearchParams]. * * The following fields are required: * ```java @@ -123,7 +123,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [RetrieverSearchParams]. */ + /** A builder for [QuerySearchParams]. */ class Builder internal constructor() { private var retrieverId: String? = null @@ -134,13 +134,13 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(retrieverSearchParams: RetrieverSearchParams) = apply { - retrieverId = retrieverSearchParams.retrieverId - organizationId = retrieverSearchParams.organizationId - projectId = retrieverSearchParams.projectId - body = retrieverSearchParams.body.toBuilder() - additionalHeaders = retrieverSearchParams.additionalHeaders.toBuilder() - additionalQueryParams = retrieverSearchParams.additionalQueryParams.toBuilder() + internal fun from(querySearchParams: QuerySearchParams) = apply { + retrieverId = querySearchParams.retrieverId + organizationId = querySearchParams.organizationId + projectId = querySearchParams.projectId + body = querySearchParams.body.toBuilder() + additionalHeaders = querySearchParams.additionalHeaders.toBuilder() + additionalQueryParams = querySearchParams.additionalQueryParams.toBuilder() } fun retrieverId(retrieverId: String?) = apply { this.retrieverId = retrieverId } @@ -353,7 +353,7 @@ private constructor( } /** - * Returns an immutable instance of [RetrieverSearchParams]. + * Returns an immutable instance of [QuerySearchParams]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -364,8 +364,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): RetrieverSearchParams = - RetrieverSearchParams( + fun build(): QuerySearchParams = + QuerySearchParams( retrieverId, organizationId, projectId, @@ -709,7 +709,7 @@ private constructor( return true } - return other is RetrieverSearchParams && + return other is QuerySearchParams && retrieverId == other.retrieverId && organizationId == other.organizationId && projectId == other.projectId && @@ -729,5 +729,5 @@ private constructor( ) override fun toString() = - "RetrieverSearchParams{retrieverId=$retrieverId, organizationId=$organizationId, projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "QuerySearchParams{retrieverId=$retrieverId, organizationId=$organizationId, projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsync.kt index ea05e14..43438d8 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsync.kt @@ -16,8 +16,7 @@ import com.llamacloud_prod.api.models.retrievers.RetrieverListParams import com.llamacloud_prod.api.models.retrievers.RetrieverSearchParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpdateParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpsertParams -import com.llamacloud_prod.api.services.async.RetrieverServiceAsync -import com.llamacloud_prod.api.services.async.retrievers.RetrieverServiceAsync +import com.llamacloud_prod.api.services.async.retrievers.QueryServiceAsync import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -35,7 +34,7 @@ interface RetrieverServiceAsync { */ fun withOptions(modifier: Consumer): RetrieverServiceAsync - fun retriever(): RetrieverServiceAsync + fun query(): QueryServiceAsync /** Create a new Retriever. */ fun create(params: RetrieverCreateParams): CompletableFuture = @@ -213,7 +212,7 @@ interface RetrieverServiceAsync { modifier: Consumer ): RetrieverServiceAsync.WithRawResponse - fun retriever(): RetrieverServiceAsync.WithRawResponse + fun query(): QueryServiceAsync.WithRawResponse /** * Returns a raw HTTP response for `post /api/v1/retrievers`, but is otherwise the same as diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsyncImpl.kt index 056dff7..9f9597e 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/RetrieverServiceAsyncImpl.kt @@ -26,10 +26,8 @@ import com.llamacloud_prod.api.models.retrievers.RetrieverListParams import com.llamacloud_prod.api.models.retrievers.RetrieverSearchParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpdateParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpsertParams -import com.llamacloud_prod.api.services.async.RetrieverServiceAsync -import com.llamacloud_prod.api.services.async.RetrieverServiceAsyncImpl -import com.llamacloud_prod.api.services.async.retrievers.RetrieverServiceAsync -import com.llamacloud_prod.api.services.async.retrievers.RetrieverServiceAsyncImpl +import com.llamacloud_prod.api.services.async.retrievers.QueryServiceAsync +import com.llamacloud_prod.api.services.async.retrievers.QueryServiceAsyncImpl import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -41,16 +39,14 @@ class RetrieverServiceAsyncImpl internal constructor(private val clientOptions: WithRawResponseImpl(clientOptions) } - private val retriever: RetrieverServiceAsync by lazy { - RetrieverServiceAsyncImpl(clientOptions) - } + private val query: QueryServiceAsync by lazy { QueryServiceAsyncImpl(clientOptions) } override fun withRawResponse(): RetrieverServiceAsync.WithRawResponse = withRawResponse override fun withOptions(modifier: Consumer): RetrieverServiceAsync = RetrieverServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun retriever(): RetrieverServiceAsync = retriever + override fun query(): QueryServiceAsync = query override fun create( params: RetrieverCreateParams, @@ -107,8 +103,8 @@ class RetrieverServiceAsyncImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - private val retriever: RetrieverServiceAsync.WithRawResponse by lazy { - RetrieverServiceAsyncImpl.WithRawResponseImpl(clientOptions) + private val query: QueryServiceAsync.WithRawResponse by lazy { + QueryServiceAsyncImpl.WithRawResponseImpl(clientOptions) } override fun withOptions( @@ -118,7 +114,7 @@ class RetrieverServiceAsyncImpl internal constructor(private val clientOptions: clientOptions.toBuilder().apply(modifier::accept).build() ) - override fun retriever(): RetrieverServiceAsync.WithRawResponse = retriever + override fun query(): QueryServiceAsync.WithRawResponse = query private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsync.kt similarity index 78% rename from llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsync.kt rename to llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsync.kt index 4841c76..2f87cb5 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsync.kt @@ -6,11 +6,11 @@ import com.llamacloud_prod.api.core.ClientOptions import com.llamacloud_prod.api.core.RequestOptions import com.llamacloud_prod.api.core.http.HttpResponseFor import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalResult -import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams +import com.llamacloud_prod.api.models.retrievers.query.QuerySearchParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer -interface RetrieverServiceAsync { +interface QueryServiceAsync { /** * Returns a view of this service that provides access to raw HTTP responses for each method. @@ -22,36 +22,34 @@ interface RetrieverServiceAsync { * * The original service is not modified. */ - fun withOptions(modifier: Consumer): RetrieverServiceAsync + fun withOptions(modifier: Consumer): QueryServiceAsync /** Retrieve data using a Retriever. */ fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, ): CompletableFuture = search(retrieverId, params, RequestOptions.none()) /** @see search */ fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture = search(params.toBuilder().retrieverId(retrieverId).build(), requestOptions) /** @see search */ - fun search(params: RetrieverSearchParams): CompletableFuture = + fun search(params: QuerySearchParams): CompletableFuture = search(params, RequestOptions.none()) /** @see search */ fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** - * A view of [RetrieverServiceAsync] that provides access to raw HTTP responses for each method. - */ + /** A view of [QueryServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { /** @@ -61,35 +59,35 @@ interface RetrieverServiceAsync { */ fun withOptions( modifier: Consumer - ): RetrieverServiceAsync.WithRawResponse + ): QueryServiceAsync.WithRawResponse /** * Returns a raw HTTP response for `post /api/v1/retrievers/{retriever_id}/retrieve`, but is - * otherwise the same as [RetrieverServiceAsync.search]. + * otherwise the same as [QueryServiceAsync.search]. */ fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, ): CompletableFuture> = search(retrieverId, params, RequestOptions.none()) /** @see search */ fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> = search(params.toBuilder().retrieverId(retrieverId).build(), requestOptions) /** @see search */ fun search( - params: RetrieverSearchParams + params: QuerySearchParams ): CompletableFuture> = search(params, RequestOptions.none()) /** @see search */ fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsyncImpl.kt similarity index 82% rename from llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsyncImpl.kt rename to llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsyncImpl.kt index 1c01a6c..77fc1ad 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsyncImpl.kt @@ -17,40 +17,40 @@ import com.llamacloud_prod.api.core.http.json import com.llamacloud_prod.api.core.http.parseable import com.llamacloud_prod.api.core.prepareAsync import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalResult -import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams +import com.llamacloud_prod.api.models.retrievers.query.QuerySearchParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -class RetrieverServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - RetrieverServiceAsync { +class QueryServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + QueryServiceAsync { - private val withRawResponse: RetrieverServiceAsync.WithRawResponse by lazy { + private val withRawResponse: QueryServiceAsync.WithRawResponse by lazy { WithRawResponseImpl(clientOptions) } - override fun withRawResponse(): RetrieverServiceAsync.WithRawResponse = withRawResponse + override fun withRawResponse(): QueryServiceAsync.WithRawResponse = withRawResponse - override fun withOptions(modifier: Consumer): RetrieverServiceAsync = - RetrieverServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun withOptions(modifier: Consumer): QueryServiceAsync = + QueryServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) override fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions, ): CompletableFuture = // post /api/v1/retrievers/{retriever_id}/retrieve withRawResponse().search(params, requestOptions).thenApply { it.parse() } class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - RetrieverServiceAsync.WithRawResponse { + QueryServiceAsync.WithRawResponse { private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) override fun withOptions( modifier: Consumer - ): RetrieverServiceAsync.WithRawResponse = - RetrieverServiceAsyncImpl.WithRawResponseImpl( + ): QueryServiceAsync.WithRawResponse = + QueryServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) @@ -58,7 +58,7 @@ class RetrieverServiceAsyncImpl internal constructor(private val clientOptions: jsonHandler(clientOptions.jsonMapper) override fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions, ): CompletableFuture> { // We check here instead of in the params builder because this can be specified diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverService.kt index 8c597f6..365878e 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverService.kt @@ -17,8 +17,7 @@ import com.llamacloud_prod.api.models.retrievers.RetrieverListParams import com.llamacloud_prod.api.models.retrievers.RetrieverSearchParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpdateParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpsertParams -import com.llamacloud_prod.api.services.blocking.RetrieverService -import com.llamacloud_prod.api.services.blocking.retrievers.RetrieverService +import com.llamacloud_prod.api.services.blocking.retrievers.QueryService import java.util.function.Consumer interface RetrieverService { @@ -35,7 +34,7 @@ interface RetrieverService { */ fun withOptions(modifier: Consumer): RetrieverService - fun retriever(): RetrieverService + fun query(): QueryService /** Create a new Retriever. */ fun create(params: RetrieverCreateParams): Retriever = create(params, RequestOptions.none()) @@ -196,7 +195,7 @@ interface RetrieverService { */ fun withOptions(modifier: Consumer): RetrieverService.WithRawResponse - fun retriever(): RetrieverService.WithRawResponse + fun query(): QueryService.WithRawResponse /** * Returns a raw HTTP response for `post /api/v1/retrievers`, but is otherwise the same as diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverServiceImpl.kt index 47d7704..f522c33 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/RetrieverServiceImpl.kt @@ -26,10 +26,8 @@ import com.llamacloud_prod.api.models.retrievers.RetrieverListParams import com.llamacloud_prod.api.models.retrievers.RetrieverSearchParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpdateParams import com.llamacloud_prod.api.models.retrievers.RetrieverUpsertParams -import com.llamacloud_prod.api.services.blocking.RetrieverService -import com.llamacloud_prod.api.services.blocking.RetrieverServiceImpl -import com.llamacloud_prod.api.services.blocking.retrievers.RetrieverService -import com.llamacloud_prod.api.services.blocking.retrievers.RetrieverServiceImpl +import com.llamacloud_prod.api.services.blocking.retrievers.QueryService +import com.llamacloud_prod.api.services.blocking.retrievers.QueryServiceImpl import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -40,14 +38,14 @@ class RetrieverServiceImpl internal constructor(private val clientOptions: Clien WithRawResponseImpl(clientOptions) } - private val retriever: RetrieverService by lazy { RetrieverServiceImpl(clientOptions) } + private val query: QueryService by lazy { QueryServiceImpl(clientOptions) } override fun withRawResponse(): RetrieverService.WithRawResponse = withRawResponse override fun withOptions(modifier: Consumer): RetrieverService = RetrieverServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun retriever(): RetrieverService = retriever + override fun query(): QueryService = query override fun create(params: RetrieverCreateParams, requestOptions: RequestOptions): Retriever = // post /api/v1/retrievers @@ -90,8 +88,8 @@ class RetrieverServiceImpl internal constructor(private val clientOptions: Clien private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - private val retriever: RetrieverService.WithRawResponse by lazy { - RetrieverServiceImpl.WithRawResponseImpl(clientOptions) + private val query: QueryService.WithRawResponse by lazy { + QueryServiceImpl.WithRawResponseImpl(clientOptions) } override fun withOptions( @@ -101,7 +99,7 @@ class RetrieverServiceImpl internal constructor(private val clientOptions: Clien clientOptions.toBuilder().apply(modifier::accept).build() ) - override fun retriever(): RetrieverService.WithRawResponse = retriever + override fun query(): QueryService.WithRawResponse = query private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryService.kt similarity index 76% rename from llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverService.kt rename to llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryService.kt index 36a4ea4..fa3948d 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryService.kt @@ -7,10 +7,10 @@ import com.llamacloud_prod.api.core.ClientOptions import com.llamacloud_prod.api.core.RequestOptions import com.llamacloud_prod.api.core.http.HttpResponseFor import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalResult -import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams +import com.llamacloud_prod.api.models.retrievers.query.QuerySearchParams import java.util.function.Consumer -interface RetrieverService { +interface QueryService { /** * Returns a view of this service that provides access to raw HTTP responses for each method. @@ -22,31 +22,31 @@ interface RetrieverService { * * The original service is not modified. */ - fun withOptions(modifier: Consumer): RetrieverService + fun withOptions(modifier: Consumer): QueryService /** Retrieve data using a Retriever. */ - fun search(retrieverId: String, params: RetrieverSearchParams): CompositeRetrievalResult = + fun search(retrieverId: String, params: QuerySearchParams): CompositeRetrievalResult = search(retrieverId, params, RequestOptions.none()) /** @see search */ fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompositeRetrievalResult = search(params.toBuilder().retrieverId(retrieverId).build(), requestOptions) /** @see search */ - fun search(params: RetrieverSearchParams): CompositeRetrievalResult = + fun search(params: QuerySearchParams): CompositeRetrievalResult = search(params, RequestOptions.none()) /** @see search */ fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompositeRetrievalResult - /** A view of [RetrieverService] that provides access to raw HTTP responses for each method. */ + /** A view of [QueryService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { /** @@ -54,16 +54,16 @@ interface RetrieverService { * * The original service is not modified. */ - fun withOptions(modifier: Consumer): RetrieverService.WithRawResponse + fun withOptions(modifier: Consumer): QueryService.WithRawResponse /** * Returns a raw HTTP response for `post /api/v1/retrievers/{retriever_id}/retrieve`, but is - * otherwise the same as [RetrieverService.search]. + * otherwise the same as [QueryService.search]. */ @MustBeClosed fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, ): HttpResponseFor = search(retrieverId, params, RequestOptions.none()) @@ -71,20 +71,20 @@ interface RetrieverService { @MustBeClosed fun search( retrieverId: String, - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor = search(params.toBuilder().retrieverId(retrieverId).build(), requestOptions) /** @see search */ @MustBeClosed - fun search(params: RetrieverSearchParams): HttpResponseFor = + fun search(params: QuerySearchParams): HttpResponseFor = search(params, RequestOptions.none()) /** @see search */ @MustBeClosed fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryServiceImpl.kt similarity index 82% rename from llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverServiceImpl.kt rename to llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryServiceImpl.kt index e4ebbde..bc2d4ed 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryServiceImpl.kt @@ -17,39 +17,39 @@ import com.llamacloud_prod.api.core.http.json import com.llamacloud_prod.api.core.http.parseable import com.llamacloud_prod.api.core.prepare import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalResult -import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams +import com.llamacloud_prod.api.models.retrievers.query.QuerySearchParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -class RetrieverServiceImpl internal constructor(private val clientOptions: ClientOptions) : - RetrieverService { +class QueryServiceImpl internal constructor(private val clientOptions: ClientOptions) : + QueryService { - private val withRawResponse: RetrieverService.WithRawResponse by lazy { + private val withRawResponse: QueryService.WithRawResponse by lazy { WithRawResponseImpl(clientOptions) } - override fun withRawResponse(): RetrieverService.WithRawResponse = withRawResponse + override fun withRawResponse(): QueryService.WithRawResponse = withRawResponse - override fun withOptions(modifier: Consumer): RetrieverService = - RetrieverServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun withOptions(modifier: Consumer): QueryService = + QueryServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) override fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions, ): CompositeRetrievalResult = // post /api/v1/retrievers/{retriever_id}/retrieve withRawResponse().search(params, requestOptions).parse() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - RetrieverService.WithRawResponse { + QueryService.WithRawResponse { private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) override fun withOptions( modifier: Consumer - ): RetrieverService.WithRawResponse = - RetrieverServiceImpl.WithRawResponseImpl( + ): QueryService.WithRawResponse = + QueryServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) @@ -57,7 +57,7 @@ class RetrieverServiceImpl internal constructor(private val clientOptions: Clien jsonHandler(clientOptions.jsonMapper) override fun search( - params: RetrieverSearchParams, + params: QuerySearchParams, requestOptions: RequestOptions, ): HttpResponseFor { // We check here instead of in the params builder because this can be specified diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/retriever/RetrieverSearchParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/query/QuerySearchParamsTest.kt similarity index 90% rename from llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/retriever/RetrieverSearchParamsTest.kt rename to llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/query/QuerySearchParamsTest.kt index bdc1a38..e000650 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/retriever/RetrieverSearchParamsTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/retrievers/query/QuerySearchParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.llamacloud_prod.api.models.retrievers.retriever +package com.llamacloud_prod.api.models.retrievers.query import com.llamacloud_prod.api.core.http.QueryParams import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalMode @@ -8,11 +8,11 @@ import com.llamacloud_prod.api.models.retrievers.ReRankConfig import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class RetrieverSearchParamsTest { +internal class QuerySearchParamsTest { @Test fun create() { - RetrieverSearchParams.builder() + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -28,7 +28,7 @@ internal class RetrieverSearchParamsTest { @Test fun pathParams() { val params = - RetrieverSearchParams.builder() + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .query("x") .build() @@ -41,7 +41,7 @@ internal class RetrieverSearchParamsTest { @Test fun queryParams() { val params = - RetrieverSearchParams.builder() + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -67,7 +67,7 @@ internal class RetrieverSearchParamsTest { @Test fun queryParamsWithoutOptionalFields() { val params = - RetrieverSearchParams.builder() + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .query("x") .build() @@ -80,7 +80,7 @@ internal class RetrieverSearchParamsTest { @Test fun body() { val params = - RetrieverSearchParams.builder() + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -106,7 +106,7 @@ internal class RetrieverSearchParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - RetrieverSearchParams.builder() + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .query("x") .build() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsyncTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsyncTest.kt similarity index 82% rename from llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsyncTest.kt rename to llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsyncTest.kt index 35daf1e..d3a706e 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/RetrieverServiceAsyncTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/retrievers/QueryServiceAsyncTest.kt @@ -5,21 +5,21 @@ package com.llamacloud_prod.api.services.async.retrievers import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClientAsync import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalMode import com.llamacloud_prod.api.models.retrievers.ReRankConfig -import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams +import com.llamacloud_prod.api.models.retrievers.query.QuerySearchParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -internal class RetrieverServiceAsyncTest { +internal class QueryServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun search() { val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val retrieverServiceAsync = client.retrievers().retriever() + val queryServiceAsync = client.retrievers().query() val compositeRetrievalResultFuture = - retrieverServiceAsync.search( - RetrieverSearchParams.builder() + queryServiceAsync.search( + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverServiceTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryServiceTest.kt similarity index 82% rename from llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverServiceTest.kt rename to llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryServiceTest.kt index fb9a410..963f357 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/RetrieverServiceTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/retrievers/QueryServiceTest.kt @@ -5,21 +5,21 @@ package com.llamacloud_prod.api.services.blocking.retrievers import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalMode import com.llamacloud_prod.api.models.retrievers.ReRankConfig -import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams +import com.llamacloud_prod.api.models.retrievers.query.QuerySearchParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -internal class RetrieverServiceTest { +internal class QueryServiceTest { @Disabled("Mock server tests are disabled") @Test fun search() { val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val retrieverService = client.retrievers().retriever() + val queryService = client.retrievers().query() val compositeRetrievalResult = - retrieverService.search( - RetrieverSearchParams.builder() + queryService.search( + QuerySearchParams.builder() .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") From 12063a12b03db64c476e9477692f9feb50d3831e Mon Sep 17 00:00:00 2001 From: justinHe123 Date: Wed, 17 Jun 2026 13:16:22 -0700 Subject: [PATCH 3/7] Add stlc-promote workflow Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/stlc-promote.yml | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/stlc-promote.yml diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml new file mode 100644 index 0000000..0f9770c --- /dev/null +++ b/.github/workflows/stlc-promote.yml @@ -0,0 +1,73 @@ +name: Promote SDKs + +on: + push: + branches: [main] + +permissions: + contents: read + +jobs: + promote: + runs-on: ubuntu-latest + if: github.repository == 'run-llama/llamacloud-prod-java' + env: + PRODUCTION_REPO: run-llama/llama-parse-java + GH_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} + steps: + - name: Check out staging + uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Fetch production main + run: | + git remote add production \ + "https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git" + git fetch production main + + - name: Check whether production already has staging's content + id: diff + run: | + # Compare by CONTENT, not commit SHA. After a release, production + # carries release-please's version/changelog commits that staging + # lacks, so the SHAs always differ — a SHA check would re-open a + # spurious release PR (and push staging's now-stale manifest) on + # every push. Instead, ask whether merging staging into production + # would change production's tree: if not, production already contains + # everything on staging (it's equal, or only ahead by release + # metadata) and there is nothing to release. + MERGED=$(git merge-tree --write-tree production/main origin/main) || MERGED=conflict + PRODUCTION_TREE=$(git rev-parse 'production/main^{tree}') + if [ "$MERGED" = "$PRODUCTION_TREE" ]; then + echo "Production already contains staging's content. Nothing to release." + echo "synced=true" >> "$GITHUB_OUTPUT" + else + echo "synced=false" >> "$GITHUB_OUTPUT" + fi + + - name: Push staging main to the release branch on production + if: steps.diff.outputs.synced == 'false' + run: | + git push production origin/main:refs/heads/stainless/release --force + + - name: Open or update the release PR on production + if: steps.diff.outputs.synced == 'false' + run: | + EXISTING_PR=$(gh pr list \ + --repo "${PRODUCTION_REPO}" \ + --head stainless/release \ + --state open \ + --json number \ + --jq '.[0].number') + if [ -z "${EXISTING_PR}" ]; then + gh pr create \ + --repo "${PRODUCTION_REPO}" \ + --base main \ + --head stainless/release \ + --title "Release SDK updates" \ + --body "$(git log --oneline production/main..origin/main)" + else + echo "Release PR #${EXISTING_PR} already exists. Force-push has updated it." + fi From 5a858f68ff245350aaa9d0275890d10715a0eb0a Mon Sep 17 00:00:00 2001 From: justinHe123 Date: Wed, 17 Jun 2026 13:37:20 -0700 Subject: [PATCH 4/7] Add stlc-sync-from-production workflow Co-Authored-By: Claude Opus 4.8 (1M context) --- .../workflows/stlc-sync-from-production.yml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/stlc-sync-from-production.yml diff --git a/.github/workflows/stlc-sync-from-production.yml b/.github/workflows/stlc-sync-from-production.yml new file mode 100644 index 0000000..05b8f27 --- /dev/null +++ b/.github/workflows/stlc-sync-from-production.yml @@ -0,0 +1,72 @@ +name: Sync from production + +on: + schedule: + # A poll, not a release — tune to how often releases/contributions land on + # production. Every few hours is plenty; daily is fine. + - cron: '17 */6 * * *' + workflow_dispatch: {} + +permissions: + contents: write # push the back-sync branch on staging + pull-requests: write # open/merge the back-sync PR on staging + +concurrency: + group: stlc-sync-from-production + cancel-in-progress: true + +jobs: + sync: + runs-on: ubuntu-latest + if: github.repository == 'run-llama/llamacloud-prod-java' + env: + PRODUCTION_REPO: run-llama/llama-parse-java + PRODUCTION_REPO_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} + # The built-in token writes the branch + PR on this (staging) repo. + GH_TOKEN: ${{ github.token }} + steps: + - name: Check out staging + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Fetch production main + run: | + git remote add production \ + "https://x-access-token:${PRODUCTION_REPO_TOKEN}@github.com/${PRODUCTION_REPO}.git" + git fetch production main + + - name: Check whether production has content staging lacks + id: diff + run: | + # Inverse of the promote guard, by content not commit SHA: would + # merging production into staging change staging's tree? If not, + # staging already has production's content — nothing to pull back. + MERGED=$(git merge-tree --write-tree origin/main production/main) || MERGED=conflict + STAGING_TREE=$(git rev-parse 'origin/main^{tree}') + if [ "$MERGED" = "$STAGING_TREE" ]; then + echo "Staging already has production's content. Nothing to pull back." + echo "behind=false" >> "$GITHUB_OUTPUT" + else + echo "behind=true" >> "$GITHUB_OUTPUT" + fi + + - name: Push production main to the back-sync branch on staging + if: steps.diff.outputs.behind == 'true' + run: git push origin production/main:refs/heads/stlc/from-prod --force + + - name: Open or update the back-sync PR on staging + if: steps.diff.outputs.behind == 'true' + run: | + EXISTING_PR=$(gh pr list --head stlc/from-prod --base main --state open --json number --jq '.[0].number') + if [ -z "${EXISTING_PR}" ]; then + gh pr create \ + --base main \ + --head stlc/from-prod \ + --title "Sync release changes from production" \ + --body "Pulls production's release-please commits (and any merged contributions) back onto staging \`main\` so the next \`stlc build\` reseals against the released state. Bot-authored; safe to auto-merge." + fi + # Auto-merge so the loop is hands-off. If auto-merge isn't enabled on + # the repo, the PR is left open for a one-click merge instead. + gh pr merge stlc/from-prod --merge --auto \ + || echo "Auto-merge unavailable — merge the back-sync PR manually." From 5ee44cd24f1b98e76a8ddd5cdcaa5172e958b065 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 17 Jun 2026 22:24:15 +0000 Subject: [PATCH 5/7] Add release workflows to targets Stainless-Generated-From: c2f2722c6b7d30a8ba7de9d203f6f7e38d6295c0 --- .github/workflows/publish-sonatype.yml | 8 ++++++-- .github/workflows/release-please.yml | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index ac77d9e..4fb6259 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -1,9 +1,13 @@ -# workflow for re-running publishing to Sonatype in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/run-llama/llama-parse-java/actions/workflows/publish-sonatype.yml +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to Sonatype in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/run-llama/llama-parse-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-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..feb6aa6 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,20 @@ +name: Release Please +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + if: github.repository == 'run-llama/llama-parse-java' + runs-on: ubuntu-latest + + steps: + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 + id: release + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} From 9e039609ecf5ce2c13403f389b470a37ccd6cb88 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 18 Jun 2026 21:33:15 +0000 Subject: [PATCH 6/7] Build SDK Stainless-Generated-From: 7f7821643929d73fc1172ebdcb3a23b5bb8d0184 --- .github/workflows/test.yml | 39 + .stats.yml | 2 +- .../api/client/LlamaCloudClient.kt | 5 + .../api/client/LlamaCloudClientAsync.kt | 5 + .../api/client/LlamaCloudClientAsyncImpl.kt | 14 + .../api/client/LlamaCloudClientImpl.kt | 12 + .../api/models/CloudConfluenceDataSource.kt | 54 +- .../models/beta/batch/BatchCreateParams.kt | 30 + .../JobItemGetProcessingResultsResponse.kt | 30 + .../models/beta/sheets/SheetCreateParams.kt | 33 +- .../beta/sheets/SheetDeleteJobParams.kt | 6 +- .../api/models/beta/sheets/SheetGetParams.kt | 4 +- .../beta/sheets/SheetGetResultTableParams.kt | 6 +- .../api/models/beta/sheets/SheetListPage.kt | 1 + .../models/beta/sheets/SheetListPageAsync.kt | 1 + .../api/models/beta/sheets/SheetListParams.kt | 3 +- .../api/models/beta/sheets/SheetsJob.kt | 30 + .../models/classify/ClassifyCreateRequest.kt | 38 +- .../configurations/ExtractV2Parameters.kt | 8 +- .../configurations/ParseV2Parameters.kt | 302 +++- .../models/extract/ExtractConfiguration.kt | 8 +- .../api/models/extract/ExtractV2JobCreate.kt | 30 + .../api/models/parsing/ParsingCreateParams.kt | 430 ++++- .../models/pipelines/LlamaParseParameters.kt | 30 + .../models/pipelines/PipelineCreateParams.kt | 1 + .../models/pipelines/PipelineDeleteParams.kt | 1 + .../api/models/pipelines/PipelineGetParams.kt | 1 + .../pipelines/PipelineGetStatusParams.kt | 1 + .../models/pipelines/PipelineListParams.kt | 1 + .../pipelines/PipelineRetrieveParams.kt | 1 + .../models/pipelines/PipelineUpdateParams.kt | 1 + .../models/pipelines/PipelineUpsertParams.kt | 1 + .../DataSourceGetDataSourcesParams.kt | 1 + .../datasources/DataSourceGetStatusParams.kt | 1 + .../datasources/DataSourceSyncParams.kt | 1 + .../DataSourceUpdateDataSourcesParams.kt | 1 + .../datasources/DataSourceUpdateParams.kt | 1 + .../documents/DocumentCreateParams.kt | 1 + .../documents/DocumentDeleteParams.kt | 1 + .../documents/DocumentGetChunksParams.kt | 1 + .../pipelines/documents/DocumentGetParams.kt | 1 + .../documents/DocumentGetStatusParams.kt | 1 + .../pipelines/documents/DocumentListPage.kt | 1 + .../documents/DocumentListPageAsync.kt | 1 + .../pipelines/documents/DocumentListParams.kt | 1 + .../pipelines/documents/DocumentSyncParams.kt | 1 + .../documents/DocumentUpsertParams.kt | 1 + .../pipelines/files/FileCreateParams.kt | 1 + .../pipelines/files/FileDeleteParams.kt | 1 + .../files/FileGetStatusCountsParams.kt | 1 + .../pipelines/files/FileGetStatusParams.kt | 1 + .../pipelines/files/FileUpdateParams.kt | 1 + .../metadata/MetadataCreateParams.kt | 1 + .../metadata/MetadataDeleteAllParams.kt | 1 + .../models/pipelines/sync/SyncCancelParams.kt | 1 + .../models/pipelines/sync/SyncCreateParams.kt | 1 + .../api/models/sheets/SheetCreateParams.kt | 1606 +++++++++++++++++ .../api/models/sheets/SheetDeleteJobParams.kt | 271 +++ .../models/sheets/SheetDeleteJobResponse.kt | 122 ++ .../api/models/sheets/SheetGetParams.kt | 290 +++ .../sheets/SheetGetResultTableParams.kt | 443 +++++ .../api/models/sheets/SheetListPage.kt | 131 ++ .../api/models/sheets/SheetListPageAsync.kt | 145 ++ .../models/sheets/SheetListPageResponse.kt | 301 +++ .../api/models/sheets/SheetListParams.kt | 543 ++++++ .../services/async/PipelineServiceAsync.kt | 80 + .../async/PipelineServiceAsyncImpl.kt | 16 + .../api/services/async/SheetServiceAsync.kt | 329 ++++ .../services/async/SheetServiceAsyncImpl.kt | 272 +++ .../services/async/beta/SheetServiceAsync.kt | 61 +- .../async/beta/SheetServiceAsyncImpl.kt | 10 + .../async/pipelines/DataSourceServiceAsync.kt | 44 + .../pipelines/DataSourceServiceAsyncImpl.kt | 10 + .../async/pipelines/DocumentServiceAsync.kt | 68 + .../pipelines/DocumentServiceAsyncImpl.kt | 16 + .../async/pipelines/FileServiceAsync.kt | 44 + .../async/pipelines/FileServiceAsyncImpl.kt | 10 + .../async/pipelines/MetadataServiceAsync.kt | 20 + .../pipelines/MetadataServiceAsyncImpl.kt | 4 + .../async/pipelines/SyncServiceAsync.kt | 24 + .../async/pipelines/SyncServiceAsyncImpl.kt | 4 + .../api/services/blocking/PipelineService.kt | 84 +- .../services/blocking/PipelineServiceImpl.kt | 16 + .../api/services/blocking/SheetService.kt | 325 ++++ .../api/services/blocking/SheetServiceImpl.kt | 246 +++ .../services/blocking/beta/SheetService.kt | 65 +- .../blocking/beta/SheetServiceImpl.kt | 10 + .../blocking/pipelines/DataSourceService.kt | 44 + .../pipelines/DataSourceServiceImpl.kt | 10 + .../blocking/pipelines/DocumentService.kt | 68 + .../blocking/pipelines/DocumentServiceImpl.kt | 16 + .../blocking/pipelines/FileService.kt | 44 + .../blocking/pipelines/FileServiceImpl.kt | 10 + .../blocking/pipelines/MetadataService.kt | 20 + .../blocking/pipelines/MetadataServiceImpl.kt | 4 + .../blocking/pipelines/SyncService.kt | 24 + .../blocking/pipelines/SyncServiceImpl.kt | 4 + .../models/CloudConfluenceDataSourceTest.kt | 3 + .../configurations/ParseV2ParametersTest.kt | 15 + .../models/parsing/ParsingCreateParamsTest.kt | 24 + .../models/sheets/SheetCreateParamsTest.kt | 253 +++ .../models/sheets/SheetDeleteJobParamsTest.kt | 57 + .../sheets/SheetDeleteJobResponseTest.kt | 30 + .../api/models/sheets/SheetGetParamsTest.kt | 63 + .../sheets/SheetGetResultTableParamsTest.kt | 76 + .../sheets/SheetListPageResponseTest.kt | 412 +++++ .../api/models/sheets/SheetListParamsTest.kt | 74 + .../api/services/ServiceParamsTest.kt | 6 + .../services/async/ParsingServiceAsyncTest.kt | 6 + .../services/async/SheetServiceAsyncTest.kt | 154 ++ .../services/blocking/ParsingServiceTest.kt | 6 + .../api/services/blocking/SheetServiceTest.kt | 149 ++ .../api/proguard/ProGuardCompatibilityTest.kt | 1 + 113 files changed, 8189 insertions(+), 147 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParams.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParams.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponse.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParams.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParams.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPage.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageAsync.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponse.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParams.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsync.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncImpl.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetService.kt create mode 100644 llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceImpl.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParamsTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParamsTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponseTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParamsTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParamsTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponseTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParamsTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncTest.kt create mode 100644 llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceTest.kt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bc4345a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Test +on: + push: + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' + +jobs: + test: + timeout-minutes: 15 + name: test + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up Java + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 + with: + distribution: temurin + java-version: | + 8 + 21 + cache: gradle + + - name: Set up Gradle + uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 + + - name: Run tests + run: ./scripts/test diff --git a/.stats.yml b/.stats.yml index 97e2fbf..a77bc26 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 131 +configured_endpoints: 136 diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClient.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClient.kt index 273bcc6..683b3b9 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClient.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClient.kt @@ -16,6 +16,7 @@ import com.llamacloud_prod.api.services.blocking.ParsingService import com.llamacloud_prod.api.services.blocking.PipelineService import com.llamacloud_prod.api.services.blocking.ProjectService import com.llamacloud_prod.api.services.blocking.RetrieverService +import com.llamacloud_prod.api.services.blocking.SheetService import java.util.function.Consumer /** @@ -56,6 +57,8 @@ interface LlamaCloudClient { fun files(): FileService + fun sheets(): SheetService + fun parsing(): ParsingService fun extract(): ExtractService @@ -105,6 +108,8 @@ interface LlamaCloudClient { fun files(): FileService.WithRawResponse + fun sheets(): SheetService.WithRawResponse + fun parsing(): ParsingService.WithRawResponse fun extract(): ExtractService.WithRawResponse diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsync.kt index 8881bbb..149e871 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsync.kt @@ -16,6 +16,7 @@ import com.llamacloud_prod.api.services.async.ParsingServiceAsync import com.llamacloud_prod.api.services.async.PipelineServiceAsync import com.llamacloud_prod.api.services.async.ProjectServiceAsync import com.llamacloud_prod.api.services.async.RetrieverServiceAsync +import com.llamacloud_prod.api.services.async.SheetServiceAsync import java.util.function.Consumer /** @@ -56,6 +57,8 @@ interface LlamaCloudClientAsync { fun files(): FileServiceAsync + fun sheets(): SheetServiceAsync + fun parsing(): ParsingServiceAsync fun extract(): ExtractServiceAsync @@ -109,6 +112,8 @@ interface LlamaCloudClientAsync { fun files(): FileServiceAsync.WithRawResponse + fun sheets(): SheetServiceAsync.WithRawResponse + fun parsing(): ParsingServiceAsync.WithRawResponse fun extract(): ExtractServiceAsync.WithRawResponse diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsyncImpl.kt index b10da21..8ff9218 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientAsyncImpl.kt @@ -30,6 +30,8 @@ import com.llamacloud_prod.api.services.async.ProjectServiceAsync import com.llamacloud_prod.api.services.async.ProjectServiceAsyncImpl import com.llamacloud_prod.api.services.async.RetrieverServiceAsync import com.llamacloud_prod.api.services.async.RetrieverServiceAsyncImpl +import com.llamacloud_prod.api.services.async.SheetServiceAsync +import com.llamacloud_prod.api.services.async.SheetServiceAsyncImpl import java.util.function.Consumer class LlamaCloudClientAsyncImpl(private val clientOptions: ClientOptions) : LlamaCloudClientAsync { @@ -51,6 +53,10 @@ class LlamaCloudClientAsyncImpl(private val clientOptions: ClientOptions) : Llam private val files: FileServiceAsync by lazy { FileServiceAsyncImpl(clientOptionsWithUserAgent) } + private val sheets: SheetServiceAsync by lazy { + SheetServiceAsyncImpl(clientOptionsWithUserAgent) + } + private val parsing: ParsingServiceAsync by lazy { ParsingServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -106,6 +112,8 @@ class LlamaCloudClientAsyncImpl(private val clientOptions: ClientOptions) : Llam override fun files(): FileServiceAsync = files + override fun sheets(): SheetServiceAsync = sheets + override fun parsing(): ParsingServiceAsync = parsing override fun extract(): ExtractServiceAsync = extract @@ -139,6 +147,10 @@ class LlamaCloudClientAsyncImpl(private val clientOptions: ClientOptions) : Llam FileServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val sheets: SheetServiceAsync.WithRawResponse by lazy { + SheetServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val parsing: ParsingServiceAsync.WithRawResponse by lazy { ParsingServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -196,6 +208,8 @@ class LlamaCloudClientAsyncImpl(private val clientOptions: ClientOptions) : Llam override fun files(): FileServiceAsync.WithRawResponse = files + override fun sheets(): SheetServiceAsync.WithRawResponse = sheets + override fun parsing(): ParsingServiceAsync.WithRawResponse = parsing override fun extract(): ExtractServiceAsync.WithRawResponse = extract diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientImpl.kt index 3171b5a..85af96c 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/client/LlamaCloudClientImpl.kt @@ -30,6 +30,8 @@ import com.llamacloud_prod.api.services.blocking.ProjectService import com.llamacloud_prod.api.services.blocking.ProjectServiceImpl import com.llamacloud_prod.api.services.blocking.RetrieverService import com.llamacloud_prod.api.services.blocking.RetrieverServiceImpl +import com.llamacloud_prod.api.services.blocking.SheetService +import com.llamacloud_prod.api.services.blocking.SheetServiceImpl import java.util.function.Consumer class LlamaCloudClientImpl(private val clientOptions: ClientOptions) : LlamaCloudClient { @@ -51,6 +53,8 @@ class LlamaCloudClientImpl(private val clientOptions: ClientOptions) : LlamaClou private val files: FileService by lazy { FileServiceImpl(clientOptionsWithUserAgent) } + private val sheets: SheetService by lazy { SheetServiceImpl(clientOptionsWithUserAgent) } + private val parsing: ParsingService by lazy { ParsingServiceImpl(clientOptionsWithUserAgent) } private val extract: ExtractService by lazy { ExtractServiceImpl(clientOptionsWithUserAgent) } @@ -98,6 +102,8 @@ class LlamaCloudClientImpl(private val clientOptions: ClientOptions) : LlamaClou override fun files(): FileService = files + override fun sheets(): SheetService = sheets + override fun parsing(): ParsingService = parsing override fun extract(): ExtractService = extract @@ -131,6 +137,10 @@ class LlamaCloudClientImpl(private val clientOptions: ClientOptions) : LlamaClou FileServiceImpl.WithRawResponseImpl(clientOptions) } + private val sheets: SheetService.WithRawResponse by lazy { + SheetServiceImpl.WithRawResponseImpl(clientOptions) + } + private val parsing: ParsingService.WithRawResponse by lazy { ParsingServiceImpl.WithRawResponseImpl(clientOptions) } @@ -188,6 +198,8 @@ class LlamaCloudClientImpl(private val clientOptions: ClientOptions) : LlamaClou override fun files(): FileService.WithRawResponse = files + override fun sheets(): SheetService.WithRawResponse = sheets + override fun parsing(): ParsingService.WithRawResponse = parsing override fun extract(): ExtractService.WithRawResponse = extract diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSource.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSource.kt index 15fab1b..74df0a6 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSource.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSource.kt @@ -32,6 +32,7 @@ private constructor( private val pageIds: JsonField, private val spaceKey: JsonField, private val supportsAccessControl: JsonField, + private val syncPermissions: JsonField, private val userName: JsonField, private val additionalProperties: MutableMap, ) { @@ -60,6 +61,9 @@ private constructor( @JsonProperty("supports_access_control") @ExcludeMissing supportsAccessControl: JsonField = JsonMissing.of(), + @JsonProperty("sync_permissions") + @ExcludeMissing + syncPermissions: JsonField = JsonMissing.of(), @JsonProperty("user_name") @ExcludeMissing userName: JsonField = JsonMissing.of(), ) : this( authenticationMechanism, @@ -74,6 +78,7 @@ private constructor( pageIds, spaceKey, supportsAccessControl, + syncPermissions, userName, mutableMapOf(), ) @@ -181,6 +186,17 @@ private constructor( fun supportsAccessControl(): Optional = supportsAccessControl.getOptional("supports_access_control") + /** + * Whether to fetch space-level permissions (allowed users/groups) and attach them to document + * metadata for access control. Disable for Confluence Server/Data Center versions whose + * permission APIs are unavailable (e.g. the JSON-RPC API removed in Data Center 9.2.6+), which + * otherwise surface as 401 errors during sync. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun syncPermissions(): Optional = syncPermissions.getOptional("sync_permissions") + /** * The username to use for authentication. * @@ -287,6 +303,15 @@ private constructor( @ExcludeMissing fun _supportsAccessControl(): JsonField = supportsAccessControl + /** + * Returns the raw JSON value of [syncPermissions]. + * + * Unlike [syncPermissions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("sync_permissions") + @ExcludeMissing + fun _syncPermissions(): JsonField = syncPermissions + /** * Returns the raw JSON value of [userName]. * @@ -335,6 +360,7 @@ private constructor( private var pageIds: JsonField = JsonMissing.of() private var spaceKey: JsonField = JsonMissing.of() private var supportsAccessControl: JsonField = JsonMissing.of() + private var syncPermissions: JsonField = JsonMissing.of() private var userName: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -352,6 +378,7 @@ private constructor( pageIds = cloudConfluenceDataSource.pageIds spaceKey = cloudConfluenceDataSource.spaceKey supportsAccessControl = cloudConfluenceDataSource.supportsAccessControl + syncPermissions = cloudConfluenceDataSource.syncPermissions userName = cloudConfluenceDataSource.userName additionalProperties = cloudConfluenceDataSource.additionalProperties.toMutableMap() } @@ -531,6 +558,26 @@ private constructor( this.supportsAccessControl = supportsAccessControl } + /** + * Whether to fetch space-level permissions (allowed users/groups) and attach them to + * document metadata for access control. Disable for Confluence Server/Data Center versions + * whose permission APIs are unavailable (e.g. the JSON-RPC API removed in Data Center + * 9.2.6+), which otherwise surface as 401 errors during sync. + */ + fun syncPermissions(syncPermissions: Boolean) = + syncPermissions(JsonField.of(syncPermissions)) + + /** + * Sets [Builder.syncPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.syncPermissions] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun syncPermissions(syncPermissions: JsonField) = apply { + this.syncPermissions = syncPermissions + } + /** The username to use for authentication. */ fun userName(userName: String?) = userName(JsonField.ofNullable(userName)) @@ -591,6 +638,7 @@ private constructor( pageIds, spaceKey, supportsAccessControl, + syncPermissions, userName, additionalProperties.toMutableMap(), ) @@ -623,6 +671,7 @@ private constructor( pageIds() spaceKey() supportsAccessControl() + syncPermissions() userName() validated = true } @@ -654,6 +703,7 @@ private constructor( (if (pageIds.asKnown().isPresent) 1 else 0) + (if (spaceKey.asKnown().isPresent) 1 else 0) + (if (supportsAccessControl.asKnown().isPresent) 1 else 0) + + (if (syncPermissions.asKnown().isPresent) 1 else 0) + (if (userName.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { @@ -674,6 +724,7 @@ private constructor( pageIds == other.pageIds && spaceKey == other.spaceKey && supportsAccessControl == other.supportsAccessControl && + syncPermissions == other.syncPermissions && userName == other.userName && additionalProperties == other.additionalProperties } @@ -692,6 +743,7 @@ private constructor( pageIds, spaceKey, supportsAccessControl, + syncPermissions, userName, additionalProperties, ) @@ -700,5 +752,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CloudConfluenceDataSource{authenticationMechanism=$authenticationMechanism, serverUrl=$serverUrl, apiToken=$apiToken, className=$className, cql=$cql, failureHandling=$failureHandling, indexRestrictedPages=$indexRestrictedPages, keepMarkdownFormat=$keepMarkdownFormat, label=$label, pageIds=$pageIds, spaceKey=$spaceKey, supportsAccessControl=$supportsAccessControl, userName=$userName, additionalProperties=$additionalProperties}" + "CloudConfluenceDataSource{authenticationMechanism=$authenticationMechanism, serverUrl=$serverUrl, apiToken=$apiToken, className=$className, cql=$cql, failureHandling=$failureHandling, indexRestrictedPages=$indexRestrictedPages, keepMarkdownFormat=$keepMarkdownFormat, label=$label, pageIds=$pageIds, spaceKey=$spaceKey, supportsAccessControl=$supportsAccessControl, syncPermissions=$syncPermissions, userName=$userName, additionalProperties=$additionalProperties}" } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/BatchCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/BatchCreateParams.kt index 82e1c55..8827428 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/BatchCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/BatchCreateParams.kt @@ -9726,6 +9726,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -9755,6 +9765,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -9792,6 +9807,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated with @@ -9831,6 +9851,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -9868,6 +9893,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException( diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/jobitems/JobItemGetProcessingResultsResponse.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/jobitems/JobItemGetProcessingResultsResponse.kt index 693b88a..9380ad6 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/jobitems/JobItemGetProcessingResultsResponse.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/batch/jobitems/JobItemGetProcessingResultsResponse.kt @@ -9833,6 +9833,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -9862,6 +9872,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -9899,6 +9914,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated @@ -9939,6 +9959,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -9976,6 +10001,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException( diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetCreateParams.kt index dbd292e..81949fa 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetCreateParams.kt @@ -29,9 +29,8 @@ import kotlin.jvm.optionals.getOrNull * Provide at most one of `configuration` (an inline parsing configuration) or `configuration_id` (a * saved configuration preset). If neither is provided, a default configuration is used. Optionally * include `webhook_configurations` to receive `sheets.*` status notifications. - * - * Experimental: not production-ready and subject to change. */ +@Deprecated("deprecated") class SheetCreateParams private constructor( private val organizationId: String?, @@ -1206,6 +1205,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -1235,6 +1244,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -1270,6 +1284,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated with an unknown @@ -1309,6 +1328,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -1346,6 +1370,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetDeleteJobParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetDeleteJobParams.kt index 3600b6f..5d96b0c 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetDeleteJobParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetDeleteJobParams.kt @@ -11,10 +11,8 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** - * Delete a spreadsheet parsing job and its associated data. Experimental: not production-ready and - * subject to change. - */ +/** Delete a spreadsheet parsing job and its associated data. */ +@Deprecated("deprecated") class SheetDeleteJobParams private constructor( private val spreadsheetJobId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetParams.kt index f79c883..2a82831 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetParams.kt @@ -12,9 +12,9 @@ import kotlin.jvm.optionals.getOrNull /** * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted regions - * and results if complete, skipping the separate `/results` call. Experimental: not - * production-ready and subject to change. + * and results if complete, skipping the separate `/results` call. */ +@Deprecated("deprecated") class SheetGetParams private constructor( private val spreadsheetJobId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetResultTableParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetResultTableParams.kt index 96174f2..9efb969 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetResultTableParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetGetResultTableParams.kt @@ -14,10 +14,8 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** - * Generate a presigned URL to download a specific extracted region. Experimental: not - * production-ready and subject to change. - */ +/** Generate a presigned URL to download a specific extracted region. */ +@Deprecated("deprecated") class SheetGetResultTableParams private constructor( private val spreadsheetJobId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPage.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPage.kt index 3bc071c..7708d3b 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPage.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPage.kt @@ -11,6 +11,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** @see SheetService.list */ +@Deprecated("deprecated") class SheetListPage private constructor( private val service: SheetService, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPageAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPageAsync.kt index 8584540..0ad4d93 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPageAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListPageAsync.kt @@ -13,6 +13,7 @@ import java.util.concurrent.Executor import kotlin.jvm.optionals.getOrNull /** @see SheetServiceAsync.list */ +@Deprecated("deprecated") class SheetListPageAsync private constructor( private val service: SheetServiceAsync, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListParams.kt index 0078c96..ad243d6 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetListParams.kt @@ -16,7 +16,8 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List spreadsheet parsing jobs. Experimental: not production-ready and subject to change. */ +/** List spreadsheet parsing jobs. */ +@Deprecated("deprecated") class SheetListParams private constructor( private val configurationId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetsJob.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetsJob.kt index 60c3b0c..b938dc0 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetsJob.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/beta/sheets/SheetsJob.kt @@ -1685,6 +1685,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -1714,6 +1724,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -1750,6 +1765,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated with an @@ -1789,6 +1809,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -1826,6 +1851,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/classify/ClassifyCreateRequest.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/classify/ClassifyCreateRequest.kt index 70f6e39..409b486 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/classify/ClassifyCreateRequest.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/classify/ClassifyCreateRequest.kt @@ -106,7 +106,8 @@ private constructor( fun parseJobId(): Optional = parseJobId.getOptional("parse_job_id") /** - * Idempotency key scoped to the project + * Idempotency key scoped to the project. Reusing a key returns the original job; the new + * request body is ignored. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -315,7 +316,10 @@ private constructor( @Deprecated("deprecated") fun parseJobId(parseJobId: JsonField) = apply { this.parseJobId = parseJobId } - /** Idempotency key scoped to the project */ + /** + * Idempotency key scoped to the project. Reusing a key returns the original job; the new + * request body is ignored. + */ fun transactionId(transactionId: String?) = transactionId(JsonField.ofNullable(transactionId)) @@ -819,6 +823,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -848,6 +862,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -883,6 +902,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated with an unknown @@ -922,6 +946,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -959,6 +988,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ExtractV2Parameters.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ExtractV2Parameters.kt index 6d56f2e..3a7a372 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ExtractV2Parameters.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ExtractV2Parameters.kt @@ -180,7 +180,9 @@ private constructor( /** * Use 'latest' for the latest release for the selected tier or a date string (YYYY-MM-DD - * format) to pin to the nearest release at or before that date. + * format) to pin to the nearest release at or before that date. Job responses always report the + * concrete resolved version the job runs, fixed at job creation; saved configurations keep the + * value as provided. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -515,7 +517,9 @@ private constructor( /** * Use 'latest' for the latest release for the selected tier or a date string (YYYY-MM-DD - * format) to pin to the nearest release at or before that date. + * format) to pin to the nearest release at or before that date. Job responses always report + * the concrete resolved version the job runs, fixed at job creation; saved configurations + * keep the value as provided. */ fun version(version: String) = version(JsonField.of(version)) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2Parameters.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2Parameters.kt index 1c42061..ab3454c 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2Parameters.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2Parameters.kt @@ -137,9 +137,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. * @@ -453,9 +453,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -947,9 +947,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -969,9 +969,7 @@ private constructor( @JvmField val LATEST = of("latest") - @JvmField val _2026_06_05 = of("2026-06-05") - - @JvmField val _2026_06_04 = of("2026-06-04") + @JvmField val _2026_06_11 = of("2026-06-11") @JvmField val _2025_12_11 = of("2025-12-11") @@ -981,8 +979,7 @@ private constructor( /** An enum containing [Version]'s known values. */ enum class Known { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, } @@ -997,8 +994,7 @@ private constructor( */ enum class Value { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, /** An enum member indicating that [Version] was instantiated with an unknown value. */ _UNKNOWN, @@ -1014,8 +1010,7 @@ private constructor( fun value(): Value = when (this) { LATEST -> Value.LATEST - _2026_06_05 -> Value._2026_06_05 - _2026_06_04 -> Value._2026_06_04 + _2026_06_11 -> Value._2026_06_11 _2025_12_11 -> Value._2025_12_11 else -> Value._UNKNOWN } @@ -1032,8 +1027,7 @@ private constructor( fun known(): Known = when (this) { LATEST -> Known.LATEST - _2026_06_05 -> Known._2026_06_05 - _2026_06_04 -> Known._2026_06_04 + _2026_06_11 -> Known._2026_06_11 _2025_12_11 -> Known._2025_12_11 else -> throw LlamaCloudInvalidDataException("Unknown Version: $value") } @@ -1601,6 +1595,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val html: JsonField, + private val image: JsonField, private val pdf: JsonValue, private val presentation: JsonField, private val spreadsheet: JsonField, @@ -1610,6 +1605,7 @@ private constructor( @JsonCreator private constructor( @JsonProperty("html") @ExcludeMissing html: JsonField = JsonMissing.of(), + @JsonProperty("image") @ExcludeMissing image: JsonField = JsonMissing.of(), @JsonProperty("pdf") @ExcludeMissing pdf: JsonValue = JsonMissing.of(), @JsonProperty("presentation") @ExcludeMissing @@ -1617,7 +1613,7 @@ private constructor( @JsonProperty("spreadsheet") @ExcludeMissing spreadsheet: JsonField = JsonMissing.of(), - ) : this(html, pdf, presentation, spreadsheet, mutableMapOf()) + ) : this(html, image, pdf, presentation, spreadsheet, mutableMapOf()) /** * HTML/web page parsing options (applies to .html, .htm files) @@ -1627,6 +1623,14 @@ private constructor( */ fun html(): Optional = html.getOptional("html") + /** + * Image parsing options (applies to .jpg, .jpeg, .png, .webp files) + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun image(): Optional = image.getOptional("image") + /** * PDF-specific parsing options (applies to .pdf files) * @@ -1660,6 +1664,13 @@ private constructor( */ @JsonProperty("html") @ExcludeMissing fun _html(): JsonField = html + /** + * Returns the raw JSON value of [image]. + * + * Unlike [image], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("image") @ExcludeMissing fun _image(): JsonField = image + /** * Returns the raw JSON value of [presentation]. * @@ -1701,6 +1712,7 @@ private constructor( class Builder internal constructor() { private var html: JsonField = JsonMissing.of() + private var image: JsonField = JsonMissing.of() private var pdf: JsonValue = JsonMissing.of() private var presentation: JsonField = JsonMissing.of() private var spreadsheet: JsonField = JsonMissing.of() @@ -1709,6 +1721,7 @@ private constructor( @JvmSynthetic internal fun from(inputOptions: InputOptions) = apply { html = inputOptions.html + image = inputOptions.image pdf = inputOptions.pdf presentation = inputOptions.presentation spreadsheet = inputOptions.spreadsheet @@ -1727,6 +1740,18 @@ private constructor( */ fun html(html: JsonField) = apply { this.html = html } + /** Image parsing options (applies to .jpg, .jpeg, .png, .webp files) */ + fun image(image: Image) = image(JsonField.of(image)) + + /** + * Sets [Builder.image] to an arbitrary JSON value. + * + * You should usually call [Builder.image] with a well-typed [Image] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun image(image: JsonField) = apply { this.image = image } + /** PDF-specific parsing options (applies to .pdf files) */ fun pdf(pdf: JsonValue) = apply { this.pdf = pdf } @@ -1785,6 +1810,7 @@ private constructor( fun build(): InputOptions = InputOptions( html, + image, pdf, presentation, spreadsheet, @@ -1809,6 +1835,7 @@ private constructor( } html().ifPresent { it.validate() } + image().ifPresent { it.validate() } presentation().ifPresent { it.validate() } spreadsheet().ifPresent { it.validate() } validated = true @@ -1831,6 +1858,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (html.asKnown().getOrNull()?.validity() ?: 0) + + (image.asKnown().getOrNull()?.validity() ?: 0) + (presentation.asKnown().getOrNull()?.validity() ?: 0) + (spreadsheet.asKnown().getOrNull()?.validity() ?: 0) @@ -2159,6 +2187,199 @@ private constructor( "Html{makeAllElementsVisible=$makeAllElementsVisible, removeFixedElements=$removeFixedElements, removeNavigationElements=$removeNavigationElements, additionalProperties=$additionalProperties}" } + /** Image parsing options (applies to .jpg, .jpeg, .png, .webp files) */ + class Image + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val cameraPhotoCorrection: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("camera_photo_correction") + @ExcludeMissing + cameraPhotoCorrection: JsonField = JsonMissing.of() + ) : this(cameraPhotoCorrection, mutableMapOf()) + + /** + * Detect documents photographed with a camera (e.g. phone scans of receipts or forms), + * then crop, perspective-correct, and flatten uneven lighting and shadows before + * parsing. Supports JPEG, PNG, WebP, and HEIC/HEIF inputs. Improves results when the + * document is tilted or surrounded by background. Images that already look like clean + * scans are left untouched + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun cameraPhotoCorrection(): Optional = + cameraPhotoCorrection.getOptional("camera_photo_correction") + + /** + * Returns the raw JSON value of [cameraPhotoCorrection]. + * + * Unlike [cameraPhotoCorrection], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("camera_photo_correction") + @ExcludeMissing + fun _cameraPhotoCorrection(): JsonField = cameraPhotoCorrection + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Image]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Image]. */ + class Builder internal constructor() { + + private var cameraPhotoCorrection: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(image: Image) = apply { + cameraPhotoCorrection = image.cameraPhotoCorrection + additionalProperties = image.additionalProperties.toMutableMap() + } + + /** + * Detect documents photographed with a camera (e.g. phone scans of receipts or + * forms), then crop, perspective-correct, and flatten uneven lighting and shadows + * before parsing. Supports JPEG, PNG, WebP, and HEIC/HEIF inputs. Improves results + * when the document is tilted or surrounded by background. Images that already look + * like clean scans are left untouched + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: Boolean?) = + cameraPhotoCorrection(JsonField.ofNullable(cameraPhotoCorrection)) + + /** + * Alias for [Builder.cameraPhotoCorrection]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: Boolean) = + cameraPhotoCorrection(cameraPhotoCorrection as Boolean?) + + /** + * Alias for calling [Builder.cameraPhotoCorrection] with + * `cameraPhotoCorrection.orElse(null)`. + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: Optional) = + cameraPhotoCorrection(cameraPhotoCorrection.getOrNull()) + + /** + * Sets [Builder.cameraPhotoCorrection] to an arbitrary JSON value. + * + * You should usually call [Builder.cameraPhotoCorrection] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: JsonField) = apply { + this.cameraPhotoCorrection = cameraPhotoCorrection + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Image]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Image = + Image(cameraPhotoCorrection, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Image = apply { + if (validated) { + return@apply + } + + cameraPhotoCorrection() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (cameraPhotoCorrection.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Image && + cameraPhotoCorrection == other.cameraPhotoCorrection && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(cameraPhotoCorrection, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Image{cameraPhotoCorrection=$cameraPhotoCorrection, additionalProperties=$additionalProperties}" + } + /** Presentation parsing options (applies to .pptx, .ppt, .odp, .key files) */ class Presentation @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -2751,6 +2972,7 @@ private constructor( return other is InputOptions && html == other.html && + image == other.image && pdf == other.pdf && presentation == other.presentation && spreadsheet == other.spreadsheet && @@ -2758,13 +2980,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(html, pdf, presentation, spreadsheet, additionalProperties) + Objects.hash(html, image, pdf, presentation, spreadsheet, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "InputOptions{html=$html, pdf=$pdf, presentation=$presentation, spreadsheet=$spreadsheet, additionalProperties=$additionalProperties}" + "InputOptions{html=$html, image=$image, pdf=$pdf, presentation=$presentation, spreadsheet=$spreadsheet, additionalProperties=$additionalProperties}" } /** Output formatting options for markdown, text, and extracted images */ @@ -9155,9 +9377,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. * @@ -9659,9 +9881,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -11273,9 +11495,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -11298,9 +11520,7 @@ private constructor( @JvmField val LATEST = of("latest") - @JvmField val _2026_06_05 = of("2026-06-05") - - @JvmField val _2026_06_04 = of("2026-06-04") + @JvmField val _2026_06_11 = of("2026-06-11") @JvmField val _2025_12_11 = of("2025-12-11") @@ -11310,8 +11530,7 @@ private constructor( /** An enum containing [Version]'s known values. */ enum class Known { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, } @@ -11326,8 +11545,7 @@ private constructor( */ enum class Value { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, /** * An enum member indicating that [Version] was instantiated with an unknown @@ -11346,8 +11564,7 @@ private constructor( fun value(): Value = when (this) { LATEST -> Value.LATEST - _2026_06_05 -> Value._2026_06_05 - _2026_06_04 -> Value._2026_06_04 + _2026_06_11 -> Value._2026_06_11 _2025_12_11 -> Value._2025_12_11 else -> Value._UNKNOWN } @@ -11364,8 +11581,7 @@ private constructor( fun known(): Known = when (this) { LATEST -> Known.LATEST - _2026_06_05 -> Known._2026_06_05 - _2026_06_04 -> Known._2026_06_04 + _2026_06_11 -> Known._2026_06_11 _2025_12_11 -> Known._2025_12_11 else -> throw LlamaCloudInvalidDataException("Unknown Version: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractConfiguration.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractConfiguration.kt index a02d020..c6e4d23 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractConfiguration.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractConfiguration.kt @@ -164,7 +164,9 @@ private constructor( /** * Use 'latest' for the latest release for the selected tier or a date string (YYYY-MM-DD - * format) to pin to the nearest release at or before that date. + * format) to pin to the nearest release at or before that date. Job responses always report the + * concrete resolved version the job runs, fixed at job creation; saved configurations keep the + * value as provided. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -483,7 +485,9 @@ private constructor( /** * Use 'latest' for the latest release for the selected tier or a date string (YYYY-MM-DD - * format) to pin to the nearest release at or before that date. + * format) to pin to the nearest release at or before that date. Job responses always report + * the concrete resolved version the job runs, fixed at job creation; saved configurations + * keep the value as provided. */ fun version(version: String) = version(JsonField.of(version)) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractV2JobCreate.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractV2JobCreate.kt index c93adb1..016fd7a 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractV2JobCreate.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/extract/ExtractV2JobCreate.kt @@ -690,6 +690,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -719,6 +729,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -754,6 +769,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated with an unknown @@ -793,6 +813,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -830,6 +855,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParams.kt index 6d7f28e..d12a914 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParams.kt @@ -76,9 +76,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. * @@ -107,6 +107,15 @@ private constructor( */ fun clientName(): Optional = body.clientName() + /** + * ID of a saved parse configuration. When set, `tier` and `version` default to the saved + * configuration's values — omit them or pass `'configured'`. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun configurationId(): Optional = body.configurationId() + /** * Crop boundaries to process only a portion of each page. Values are ratios 0-1 from page edges * @@ -240,6 +249,13 @@ private constructor( */ fun _clientName(): JsonField = body._clientName() + /** + * Returns the raw JSON value of [configurationId]. + * + * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _configurationId(): JsonField = body._configurationId() + /** * Returns the raw JSON value of [cropBox]. * @@ -383,7 +399,7 @@ private constructor( * - [version] * - [agenticOptions] * - [clientName] - * - [cropBox] + * - [configurationId] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -402,14 +418,22 @@ private constructor( */ fun tier(tier: JsonField) = apply { body.tier(tier) } + /** + * Sets [tier] to an arbitrary [String]. + * + * You should usually call [tier] with a well-typed [Tier] constant instead. This method is + * primarily for setting the field to an undocumented or not yet supported value. + */ + fun tier(value: String) = apply { body.tier(value) } + /** * Version for the selected tier. Use `latest`, or pin one of that tier's dated versions. * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -474,6 +498,29 @@ private constructor( */ fun clientName(clientName: JsonField) = apply { body.clientName(clientName) } + /** + * ID of a saved parse configuration. When set, `tier` and `version` default to the saved + * configuration's values — omit them or pass `'configured'`. + */ + fun configurationId(configurationId: String?) = apply { + body.configurationId(configurationId) + } + + /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ + fun configurationId(configurationId: Optional) = + configurationId(configurationId.getOrNull()) + + /** + * Sets [Builder.configurationId] to an arbitrary JSON value. + * + * You should usually call [Builder.configurationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun configurationId(configurationId: JsonField) = apply { + body.configurationId(configurationId) + } + /** * Crop boundaries to process only a portion of each page. Values are ratios 0-1 from page * edges @@ -841,6 +888,7 @@ private constructor( private val version: JsonField, private val agenticOptions: JsonField, private val clientName: JsonField, + private val configurationId: JsonField, private val cropBox: JsonField, private val disableCache: JsonField, private val fastOptions: JsonValue, @@ -866,6 +914,9 @@ private constructor( @JsonProperty("client_name") @ExcludeMissing clientName: JsonField = JsonMissing.of(), + @JsonProperty("configuration_id") + @ExcludeMissing + configurationId: JsonField = JsonMissing.of(), @JsonProperty("crop_box") @ExcludeMissing cropBox: JsonField = JsonMissing.of(), @@ -903,6 +954,7 @@ private constructor( version, agenticOptions, clientName, + configurationId, cropBox, disableCache, fastOptions, @@ -932,9 +984,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. * @@ -964,6 +1016,15 @@ private constructor( */ fun clientName(): Optional = clientName.getOptional("client_name") + /** + * ID of a saved parse configuration. When set, `tier` and `version` default to the saved + * configuration's values — omit them or pass `'configured'`. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun configurationId(): Optional = configurationId.getOptional("configuration_id") + /** * Crop boundaries to process only a portion of each page. Values are ratios 0-1 from page * edges @@ -1107,6 +1168,16 @@ private constructor( @ExcludeMissing fun _clientName(): JsonField = clientName + /** + * Returns the raw JSON value of [configurationId]. + * + * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("configuration_id") + @ExcludeMissing + fun _configurationId(): JsonField = configurationId + /** * Returns the raw JSON value of [cropBox]. * @@ -1237,6 +1308,7 @@ private constructor( private var version: JsonField? = null private var agenticOptions: JsonField = JsonMissing.of() private var clientName: JsonField = JsonMissing.of() + private var configurationId: JsonField = JsonMissing.of() private var cropBox: JsonField = JsonMissing.of() private var disableCache: JsonField = JsonMissing.of() private var fastOptions: JsonValue = JsonMissing.of() @@ -1257,6 +1329,7 @@ private constructor( version = body.version agenticOptions = body.agenticOptions clientName = body.clientName + configurationId = body.configurationId cropBox = body.cropBox disableCache = body.disableCache fastOptions = body.fastOptions @@ -1288,15 +1361,23 @@ private constructor( */ fun tier(tier: JsonField) = apply { this.tier = tier } + /** + * Sets [tier] to an arbitrary [String]. + * + * You should usually call [tier] with a well-typed [Tier] constant instead. This method + * is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tier(value: String) = tier(Tier.of(value)) + /** * Version for the selected tier. Use `latest`, or pin one of that tier's dated * versions. * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -1362,6 +1443,28 @@ private constructor( */ fun clientName(clientName: JsonField) = apply { this.clientName = clientName } + /** + * ID of a saved parse configuration. When set, `tier` and `version` default to the + * saved configuration's values — omit them or pass `'configured'`. + */ + fun configurationId(configurationId: String?) = + configurationId(JsonField.ofNullable(configurationId)) + + /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ + fun configurationId(configurationId: Optional) = + configurationId(configurationId.getOrNull()) + + /** + * Sets [Builder.configurationId] to an arbitrary JSON value. + * + * You should usually call [Builder.configurationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun configurationId(configurationId: JsonField) = apply { + this.configurationId = configurationId + } + /** * Crop boundaries to process only a portion of each page. Values are ratios 0-1 from * page edges @@ -1609,6 +1712,7 @@ private constructor( checkRequired("version", version), agenticOptions, clientName, + configurationId, cropBox, disableCache, fastOptions, @@ -1641,10 +1745,11 @@ private constructor( return@apply } - tier().validate() + tier() version() agenticOptions().ifPresent { it.validate() } clientName() + configurationId() cropBox().ifPresent { it.validate() } disableCache() fileId() @@ -1675,10 +1780,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (tier.asKnown().getOrNull()?.validity() ?: 0) + + (if (tier.asKnown().isPresent) 1 else 0) + (if (version.asKnown().isPresent) 1 else 0) + (agenticOptions.asKnown().getOrNull()?.validity() ?: 0) + (if (clientName.asKnown().isPresent) 1 else 0) + + (if (configurationId.asKnown().isPresent) 1 else 0) + (cropBox.asKnown().getOrNull()?.validity() ?: 0) + (if (disableCache.asKnown().isPresent) 1 else 0) + (if (fileId.asKnown().isPresent) 1 else 0) + @@ -1701,6 +1807,7 @@ private constructor( version == other.version && agenticOptions == other.agenticOptions && clientName == other.clientName && + configurationId == other.configurationId && cropBox == other.cropBox && disableCache == other.disableCache && fastOptions == other.fastOptions && @@ -1722,6 +1829,7 @@ private constructor( version, agenticOptions, clientName, + configurationId, cropBox, disableCache, fastOptions, @@ -1741,7 +1849,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{tier=$tier, version=$version, agenticOptions=$agenticOptions, clientName=$clientName, cropBox=$cropBox, disableCache=$disableCache, fastOptions=$fastOptions, fileId=$fileId, httpProxy=$httpProxy, inputOptions=$inputOptions, outputOptions=$outputOptions, pageRanges=$pageRanges, processingControl=$processingControl, processingOptions=$processingOptions, sourceUrl=$sourceUrl, webhookConfigurations=$webhookConfigurations, additionalProperties=$additionalProperties}" + "Body{tier=$tier, version=$version, agenticOptions=$agenticOptions, clientName=$clientName, configurationId=$configurationId, cropBox=$cropBox, disableCache=$disableCache, fastOptions=$fastOptions, fileId=$fileId, httpProxy=$httpProxy, inputOptions=$inputOptions, outputOptions=$outputOptions, pageRanges=$pageRanges, processingControl=$processingControl, processingOptions=$processingOptions, sourceUrl=$sourceUrl, webhookConfigurations=$webhookConfigurations, additionalProperties=$additionalProperties}" } /** @@ -1901,9 +2009,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -1923,9 +2031,7 @@ private constructor( @JvmField val LATEST = of("latest") - @JvmField val _2026_06_05 = of("2026-06-05") - - @JvmField val _2026_06_04 = of("2026-06-04") + @JvmField val _2026_06_11 = of("2026-06-11") @JvmField val _2025_12_11 = of("2025-12-11") @@ -1935,8 +2041,7 @@ private constructor( /** An enum containing [Version]'s known values. */ enum class Known { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, } @@ -1951,8 +2056,7 @@ private constructor( */ enum class Value { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, /** An enum member indicating that [Version] was instantiated with an unknown value. */ _UNKNOWN, @@ -1968,8 +2072,7 @@ private constructor( fun value(): Value = when (this) { LATEST -> Value.LATEST - _2026_06_05 -> Value._2026_06_05 - _2026_06_04 -> Value._2026_06_04 + _2026_06_11 -> Value._2026_06_11 _2025_12_11 -> Value._2025_12_11 else -> Value._UNKNOWN } @@ -1986,8 +2089,7 @@ private constructor( fun known(): Known = when (this) { LATEST -> Known.LATEST - _2026_06_05 -> Known._2026_06_05 - _2026_06_04 -> Known._2026_06_04 + _2026_06_11 -> Known._2026_06_11 _2025_12_11 -> Known._2025_12_11 else -> throw LlamaCloudInvalidDataException("Unknown Version: $value") } @@ -2555,6 +2657,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val html: JsonField, + private val image: JsonField, private val pdf: JsonValue, private val presentation: JsonField, private val spreadsheet: JsonField, @@ -2564,6 +2667,7 @@ private constructor( @JsonCreator private constructor( @JsonProperty("html") @ExcludeMissing html: JsonField = JsonMissing.of(), + @JsonProperty("image") @ExcludeMissing image: JsonField = JsonMissing.of(), @JsonProperty("pdf") @ExcludeMissing pdf: JsonValue = JsonMissing.of(), @JsonProperty("presentation") @ExcludeMissing @@ -2571,7 +2675,7 @@ private constructor( @JsonProperty("spreadsheet") @ExcludeMissing spreadsheet: JsonField = JsonMissing.of(), - ) : this(html, pdf, presentation, spreadsheet, mutableMapOf()) + ) : this(html, image, pdf, presentation, spreadsheet, mutableMapOf()) /** * HTML/web page parsing options (applies to .html, .htm files) @@ -2581,6 +2685,14 @@ private constructor( */ fun html(): Optional = html.getOptional("html") + /** + * Image parsing options (applies to .jpg, .jpeg, .png, .webp files) + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun image(): Optional = image.getOptional("image") + /** * PDF-specific parsing options (applies to .pdf files) * @@ -2614,6 +2726,13 @@ private constructor( */ @JsonProperty("html") @ExcludeMissing fun _html(): JsonField = html + /** + * Returns the raw JSON value of [image]. + * + * Unlike [image], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("image") @ExcludeMissing fun _image(): JsonField = image + /** * Returns the raw JSON value of [presentation]. * @@ -2655,6 +2774,7 @@ private constructor( class Builder internal constructor() { private var html: JsonField = JsonMissing.of() + private var image: JsonField = JsonMissing.of() private var pdf: JsonValue = JsonMissing.of() private var presentation: JsonField = JsonMissing.of() private var spreadsheet: JsonField = JsonMissing.of() @@ -2663,6 +2783,7 @@ private constructor( @JvmSynthetic internal fun from(inputOptions: InputOptions) = apply { html = inputOptions.html + image = inputOptions.image pdf = inputOptions.pdf presentation = inputOptions.presentation spreadsheet = inputOptions.spreadsheet @@ -2681,6 +2802,18 @@ private constructor( */ fun html(html: JsonField) = apply { this.html = html } + /** Image parsing options (applies to .jpg, .jpeg, .png, .webp files) */ + fun image(image: Image) = image(JsonField.of(image)) + + /** + * Sets [Builder.image] to an arbitrary JSON value. + * + * You should usually call [Builder.image] with a well-typed [Image] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun image(image: JsonField) = apply { this.image = image } + /** PDF-specific parsing options (applies to .pdf files) */ fun pdf(pdf: JsonValue) = apply { this.pdf = pdf } @@ -2739,6 +2872,7 @@ private constructor( fun build(): InputOptions = InputOptions( html, + image, pdf, presentation, spreadsheet, @@ -2763,6 +2897,7 @@ private constructor( } html().ifPresent { it.validate() } + image().ifPresent { it.validate() } presentation().ifPresent { it.validate() } spreadsheet().ifPresent { it.validate() } validated = true @@ -2785,6 +2920,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (html.asKnown().getOrNull()?.validity() ?: 0) + + (image.asKnown().getOrNull()?.validity() ?: 0) + (presentation.asKnown().getOrNull()?.validity() ?: 0) + (spreadsheet.asKnown().getOrNull()?.validity() ?: 0) @@ -3113,6 +3249,199 @@ private constructor( "Html{makeAllElementsVisible=$makeAllElementsVisible, removeFixedElements=$removeFixedElements, removeNavigationElements=$removeNavigationElements, additionalProperties=$additionalProperties}" } + /** Image parsing options (applies to .jpg, .jpeg, .png, .webp files) */ + class Image + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val cameraPhotoCorrection: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("camera_photo_correction") + @ExcludeMissing + cameraPhotoCorrection: JsonField = JsonMissing.of() + ) : this(cameraPhotoCorrection, mutableMapOf()) + + /** + * Detect documents photographed with a camera (e.g. phone scans of receipts or forms), + * then crop, perspective-correct, and flatten uneven lighting and shadows before + * parsing. Supports JPEG, PNG, WebP, and HEIC/HEIF inputs. Improves results when the + * document is tilted or surrounded by background. Images that already look like clean + * scans are left untouched + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun cameraPhotoCorrection(): Optional = + cameraPhotoCorrection.getOptional("camera_photo_correction") + + /** + * Returns the raw JSON value of [cameraPhotoCorrection]. + * + * Unlike [cameraPhotoCorrection], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("camera_photo_correction") + @ExcludeMissing + fun _cameraPhotoCorrection(): JsonField = cameraPhotoCorrection + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Image]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Image]. */ + class Builder internal constructor() { + + private var cameraPhotoCorrection: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(image: Image) = apply { + cameraPhotoCorrection = image.cameraPhotoCorrection + additionalProperties = image.additionalProperties.toMutableMap() + } + + /** + * Detect documents photographed with a camera (e.g. phone scans of receipts or + * forms), then crop, perspective-correct, and flatten uneven lighting and shadows + * before parsing. Supports JPEG, PNG, WebP, and HEIC/HEIF inputs. Improves results + * when the document is tilted or surrounded by background. Images that already look + * like clean scans are left untouched + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: Boolean?) = + cameraPhotoCorrection(JsonField.ofNullable(cameraPhotoCorrection)) + + /** + * Alias for [Builder.cameraPhotoCorrection]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: Boolean) = + cameraPhotoCorrection(cameraPhotoCorrection as Boolean?) + + /** + * Alias for calling [Builder.cameraPhotoCorrection] with + * `cameraPhotoCorrection.orElse(null)`. + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: Optional) = + cameraPhotoCorrection(cameraPhotoCorrection.getOrNull()) + + /** + * Sets [Builder.cameraPhotoCorrection] to an arbitrary JSON value. + * + * You should usually call [Builder.cameraPhotoCorrection] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun cameraPhotoCorrection(cameraPhotoCorrection: JsonField) = apply { + this.cameraPhotoCorrection = cameraPhotoCorrection + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Image]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Image = + Image(cameraPhotoCorrection, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Image = apply { + if (validated) { + return@apply + } + + cameraPhotoCorrection() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (cameraPhotoCorrection.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Image && + cameraPhotoCorrection == other.cameraPhotoCorrection && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(cameraPhotoCorrection, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Image{cameraPhotoCorrection=$cameraPhotoCorrection, additionalProperties=$additionalProperties}" + } + /** Presentation parsing options (applies to .pptx, .ppt, .odp, .key files) */ class Presentation @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -3705,6 +4034,7 @@ private constructor( return other is InputOptions && html == other.html && + image == other.image && pdf == other.pdf && presentation == other.presentation && spreadsheet == other.spreadsheet && @@ -3712,13 +4042,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(html, pdf, presentation, spreadsheet, additionalProperties) + Objects.hash(html, image, pdf, presentation, spreadsheet, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "InputOptions{html=$html, pdf=$pdf, presentation=$presentation, spreadsheet=$spreadsheet, additionalProperties=$additionalProperties}" + "InputOptions{html=$html, image=$image, pdf=$pdf, presentation=$presentation, spreadsheet=$spreadsheet, additionalProperties=$additionalProperties}" } /** Output formatting options for markdown, text, and extracted images */ @@ -10109,9 +10439,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. * @@ -10613,9 +10943,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -12227,9 +12557,9 @@ private constructor( * * Current `latest` by tier: * - `fast`: `2025-12-11` - * - `cost_effective`: `2026-06-05` - * - `agentic`: `2026-06-04` - * - `agentic_plus`: `2026-06-04` + * - `cost_effective`: `2026-06-11` + * - `agentic`: `2026-06-11` + * - `agentic_plus`: `2026-06-11` * * Full list: `GET /api/v2/parse/versions`. */ @@ -12252,9 +12582,7 @@ private constructor( @JvmField val LATEST = of("latest") - @JvmField val _2026_06_05 = of("2026-06-05") - - @JvmField val _2026_06_04 = of("2026-06-04") + @JvmField val _2026_06_11 = of("2026-06-11") @JvmField val _2025_12_11 = of("2025-12-11") @@ -12264,8 +12592,7 @@ private constructor( /** An enum containing [Version]'s known values. */ enum class Known { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, } @@ -12280,8 +12607,7 @@ private constructor( */ enum class Value { LATEST, - _2026_06_05, - _2026_06_04, + _2026_06_11, _2025_12_11, /** * An enum member indicating that [Version] was instantiated with an unknown @@ -12300,8 +12626,7 @@ private constructor( fun value(): Value = when (this) { LATEST -> Value.LATEST - _2026_06_05 -> Value._2026_06_05 - _2026_06_04 -> Value._2026_06_04 + _2026_06_11 -> Value._2026_06_11 _2025_12_11 -> Value._2025_12_11 else -> Value._UNKNOWN } @@ -12318,8 +12643,7 @@ private constructor( fun known(): Known = when (this) { LATEST -> Known.LATEST - _2026_06_05 -> Known._2026_06_05 - _2026_06_04 -> Known._2026_06_04 + _2026_06_11 -> Known._2026_06_11 _2025_12_11 -> Known._2025_12_11 else -> throw LlamaCloudInvalidDataException("Unknown Version: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/LlamaParseParameters.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/LlamaParseParameters.kt index c40be8b..299fa01 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/LlamaParseParameters.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/LlamaParseParameters.kt @@ -6674,6 +6674,16 @@ private constructor( @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + @JvmField val UNMAPPED_EVENT = of("unmapped_event") @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) @@ -6703,6 +6713,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, } @@ -6738,6 +6753,11 @@ private constructor( SHEETS_ERROR, SHEETS_PARTIAL_SUCCESS, SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, UNMAPPED_EVENT, /** * An enum member indicating that [WebhookEvent] was instantiated with an unknown @@ -6777,6 +6797,11 @@ private constructor( SHEETS_ERROR -> Value.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED UNMAPPED_EVENT -> Value.UNMAPPED_EVENT else -> Value._UNKNOWN } @@ -6814,6 +6839,11 @@ private constructor( SHEETS_ERROR -> Known.SHEETS_ERROR SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED UNMAPPED_EVENT -> Known.UNMAPPED_EVENT else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineCreateParams.kt index 0134ba0..9bacb02 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineCreateParams.kt @@ -17,6 +17,7 @@ import kotlin.jvm.optionals.getOrNull * A pipeline connects data sources to a vector store for RAG. After creation, call `POST * /pipelines/{id}/sync` to start ingesting documents. */ +@Deprecated("deprecated") class PipelineCreateParams private constructor( private val organizationId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineDeleteParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineDeleteParams.kt index a56e5eb..40d4bc9 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineDeleteParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineDeleteParams.kt @@ -16,6 +16,7 @@ import kotlin.jvm.optionals.getOrNull * * Removes pipeline files, data sources, and vector store data. This operation is irreversible. */ +@Deprecated("deprecated") class PipelineDeleteParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetParams.kt index 1a01969..37f7e83 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetParams.kt @@ -10,6 +10,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Get a pipeline by ID. */ +@Deprecated("deprecated") class PipelineGetParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetStatusParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetStatusParams.kt index 682732e..6f3c406 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetStatusParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineGetStatusParams.kt @@ -15,6 +15,7 @@ import kotlin.jvm.optionals.getOrNull * Returns document counts, sync progress, and the last effective timestamp. Only available for * managed pipelines. */ +@Deprecated("deprecated") class PipelineGetStatusParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineListParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineListParams.kt index d1f4ea0..d33e0dd 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineListParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineListParams.kt @@ -10,6 +10,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Search for pipelines by name, type, or project. */ +@Deprecated("deprecated") class PipelineListParams private constructor( private val organizationId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineRetrieveParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineRetrieveParams.kt index 870a1cc..c1ee6b1 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineRetrieveParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineRetrieveParams.kt @@ -27,6 +27,7 @@ import kotlin.jvm.optionals.getOrNull * Searches the pipeline's vector store using the provided query and retrieval parameters. Supports * dense, sparse, and hybrid search modes with configurable top-k and reranking. */ +@Deprecated("deprecated") class PipelineRetrieveParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpdateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpdateParams.kt index 52af627..9a2bf88 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpdateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpdateParams.kt @@ -31,6 +31,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Update an existing pipeline's configuration. */ +@Deprecated("deprecated") class PipelineUpdateParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpsertParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpsertParams.kt index e0147ee..f1eac7b 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpsertParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/PipelineUpsertParams.kt @@ -17,6 +17,7 @@ import kotlin.jvm.optionals.getOrNull * Updates the pipeline if one with the same name and project already exists, otherwise creates a * new one. */ +@Deprecated("deprecated") class PipelineUpsertParams private constructor( private val organizationId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetDataSourcesParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetDataSourcesParams.kt index 7da8cfe..5cdecfd 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetDataSourcesParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetDataSourcesParams.kt @@ -10,6 +10,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Get data sources for a pipeline. */ +@Deprecated("deprecated") class DataSourceGetDataSourcesParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetStatusParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetStatusParams.kt index bffa2f4..2d341a5 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetStatusParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceGetStatusParams.kt @@ -11,6 +11,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Get the status of a data source for a pipeline. */ +@Deprecated("deprecated") class DataSourceGetStatusParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceSyncParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceSyncParams.kt index 69e8a03..3c4ba32 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceSyncParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceSyncParams.kt @@ -23,6 +23,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Run incremental ingestion: pull upstream changes from the data source into the data sink. */ +@Deprecated("deprecated") class DataSourceSyncParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateDataSourcesParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateDataSourcesParams.kt index 268ff79..3ba5454 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateDataSourcesParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateDataSourcesParams.kt @@ -22,6 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Add data sources to a pipeline. */ +@Deprecated("deprecated") class DataSourceUpdateDataSourcesParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateParams.kt index 3608e14..89087f2 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/datasources/DataSourceUpdateParams.kt @@ -21,6 +21,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Update the configuration of a data source in a pipeline. */ +@Deprecated("deprecated") class DataSourceUpdateParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentCreateParams.kt index ec34a1a..58adfc0 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentCreateParams.kt @@ -12,6 +12,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Batch create documents for a pipeline. */ +@Deprecated("deprecated") class DocumentCreateParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentDeleteParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentDeleteParams.kt index 8e0c069..57ff0ab 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentDeleteParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentDeleteParams.kt @@ -13,6 +13,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Delete a document from a pipeline; runs async (vectors first, then MongoDB record). */ +@Deprecated("deprecated") class DocumentDeleteParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetChunksParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetChunksParams.kt index d96ccc4..a03949f 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetChunksParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetChunksParams.kt @@ -11,6 +11,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Return a list of chunks for a pipeline document. */ +@Deprecated("deprecated") class DocumentGetChunksParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetParams.kt index a06a9e5..4d53fde 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetParams.kt @@ -11,6 +11,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Return a single document for a pipeline. */ +@Deprecated("deprecated") class DocumentGetParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetStatusParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetStatusParams.kt index c5faa7e..c6edcea 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetStatusParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentGetStatusParams.kt @@ -11,6 +11,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Return a single document for a pipeline. */ +@Deprecated("deprecated") class DocumentGetStatusParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPage.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPage.kt index 3058002..c5412a3 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPage.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPage.kt @@ -12,6 +12,7 @@ import kotlin.jvm.optionals.getOrDefault import kotlin.jvm.optionals.getOrNull /** @see DocumentService.list */ +@Deprecated("deprecated") class DocumentListPage private constructor( private val service: DocumentService, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPageAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPageAsync.kt index 49d48f7..a2fa3df 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPageAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListPageAsync.kt @@ -14,6 +14,7 @@ import kotlin.jvm.optionals.getOrDefault import kotlin.jvm.optionals.getOrNull /** @see DocumentServiceAsync.list */ +@Deprecated("deprecated") class DocumentListPageAsync private constructor( private val service: DocumentServiceAsync, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListParams.kt index 1c28859..eca9036 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentListParams.kt @@ -14,6 +14,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Return a list of documents for a pipeline. */ +@Deprecated("deprecated") class DocumentListParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentSyncParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentSyncParams.kt index 9629d0c..4d80248 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentSyncParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentSyncParams.kt @@ -13,6 +13,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Sync a specific document for a pipeline. */ +@Deprecated("deprecated") class DocumentSyncParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentUpsertParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentUpsertParams.kt index c400d41..4f62cb4 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentUpsertParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/documents/DocumentUpsertParams.kt @@ -12,6 +12,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Batch create or update a document for a pipeline. */ +@Deprecated("deprecated") class DocumentUpsertParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileCreateParams.kt index 1217c1c..7cba914 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileCreateParams.kt @@ -22,6 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Add files to a pipeline. */ +@Deprecated("deprecated") class FileCreateParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileDeleteParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileDeleteParams.kt index 6ee9b1d..2a132c8 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileDeleteParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileDeleteParams.kt @@ -13,6 +13,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Delete a file from a pipeline. */ +@Deprecated("deprecated") class FileDeleteParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusCountsParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusCountsParams.kt index 6b1a74d..e19e029 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusCountsParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusCountsParams.kt @@ -10,6 +10,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Get files for a pipeline. */ +@Deprecated("deprecated") class FileGetStatusCountsParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusParams.kt index 26dd04c..86db2b0 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileGetStatusParams.kt @@ -11,6 +11,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Get status of a file for a pipeline. */ +@Deprecated("deprecated") class FileGetStatusParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileUpdateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileUpdateParams.kt index db13f44..8d5c0ae 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileUpdateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/files/FileUpdateParams.kt @@ -22,6 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Update a file for a pipeline. */ +@Deprecated("deprecated") class FileUpdateParams private constructor( private val pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataCreateParams.kt index d58f6ff..7ad110a 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataCreateParams.kt @@ -24,6 +24,7 @@ import kotlin.io.path.name import kotlin.jvm.optionals.getOrNull /** Import metadata for a pipeline. */ +@Deprecated("deprecated") class MetadataCreateParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataDeleteAllParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataDeleteAllParams.kt index 3c01174..df7201e 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataDeleteAllParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/metadata/MetadataDeleteAllParams.kt @@ -12,6 +12,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Delete metadata for all files in a pipeline. */ +@Deprecated("deprecated") class MetadataDeleteAllParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCancelParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCancelParams.kt index 658fd70..89a5544 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCancelParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCancelParams.kt @@ -12,6 +12,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Cancel all running sync jobs for a pipeline. */ +@Deprecated("deprecated") class SyncCancelParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCreateParams.kt index 40da414..7c8213e 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCreateParams.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/pipelines/sync/SyncCreateParams.kt @@ -17,6 +17,7 @@ import kotlin.jvm.optionals.getOrNull * Processes new and updated documents from data sources and files, then updates the index for * retrieval. */ +@Deprecated("deprecated") class SyncCreateParams private constructor( private val pipelineId: String?, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParams.kt new file mode 100644 index 0000000..6dd813a --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParams.kt @@ -0,0 +1,1606 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +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.llamacloud_prod.api.core.Enum +import com.llamacloud_prod.api.core.ExcludeMissing +import com.llamacloud_prod.api.core.JsonField +import com.llamacloud_prod.api.core.JsonMissing +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.core.Params +import com.llamacloud_prod.api.core.checkKnown +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.core.http.Headers +import com.llamacloud_prod.api.core.http.QueryParams +import com.llamacloud_prod.api.core.toImmutable +import com.llamacloud_prod.api.errors.LlamaCloudInvalidDataException +import com.llamacloud_prod.api.models.beta.sheets.SheetsParsingConfig +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create a spreadsheet parsing job. + * + * Provide at most one of `configuration` (an inline parsing configuration) or `configuration_id` (a + * saved configuration preset). If neither is provided, a default configuration is used. Optionally + * include `webhook_configurations` to receive `sheets.*` status notifications. + */ +class SheetCreateParams +private constructor( + private val organizationId: String?, + private val projectId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun organizationId(): Optional = Optional.ofNullable(organizationId) + + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** + * The ID of the file to parse + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fileId(): String = body.fileId() + + /** + * Configuration for spreadsheet parsing and region extraction + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") fun config(): Optional = body.config() + + /** + * Configuration for spreadsheet parsing and region extraction + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun configuration(): Optional = body.configuration() + + /** + * Saved configuration ID + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun configurationId(): Optional = body.configurationId() + + /** + * Outbound webhook endpoints to notify on job status changes + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun webhookConfigurations(): Optional> = body.webhookConfigurations() + + /** + * Returns the raw JSON value of [fileId]. + * + * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _fileId(): JsonField = body._fileId() + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") fun _config(): JsonField = body._config() + + /** + * Returns the raw JSON value of [configuration]. + * + * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _configuration(): JsonField = body._configuration() + + /** + * Returns the raw JSON value of [configurationId]. + * + * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _configurationId(): JsonField = body._configurationId() + + /** + * Returns the raw JSON value of [webhookConfigurations]. + * + * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _webhookConfigurations(): JsonField> = + body._webhookConfigurations() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SheetCreateParams]. + * + * The following fields are required: + * ```java + * .fileId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetCreateParams]. */ + class Builder internal constructor() { + + private var organizationId: String? = null + private var projectId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sheetCreateParams: SheetCreateParams) = apply { + organizationId = sheetCreateParams.organizationId + projectId = sheetCreateParams.projectId + body = sheetCreateParams.body.toBuilder() + additionalHeaders = sheetCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = sheetCreateParams.additionalQueryParams.toBuilder() + } + + fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } + + /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ + fun organizationId(organizationId: Optional) = + organizationId(organizationId.getOrNull()) + + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [fileId] + * - [config] + * - [configuration] + * - [configurationId] + * - [webhookConfigurations] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The ID of the file to parse */ + fun fileId(fileId: String) = apply { body.fileId(fileId) } + + /** + * Sets [Builder.fileId] to an arbitrary JSON value. + * + * You should usually call [Builder.fileId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun fileId(fileId: JsonField) = apply { body.fileId(fileId) } + + /** Configuration for spreadsheet parsing and region extraction */ + @Deprecated("deprecated") + fun config(config: SheetsParsingConfig?) = apply { body.config(config) } + + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ + @Deprecated("deprecated") + fun config(config: Optional) = config(config.getOrNull()) + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun config(config: JsonField) = apply { body.config(config) } + + /** Configuration for spreadsheet parsing and region extraction */ + fun configuration(configuration: SheetsParsingConfig?) = apply { + body.configuration(configuration) + } + + /** Alias for calling [Builder.configuration] with `configuration.orElse(null)`. */ + fun configuration(configuration: Optional) = + configuration(configuration.getOrNull()) + + /** + * Sets [Builder.configuration] to an arbitrary JSON value. + * + * You should usually call [Builder.configuration] with a well-typed [SheetsParsingConfig] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun configuration(configuration: JsonField) = apply { + body.configuration(configuration) + } + + /** Saved configuration ID */ + fun configurationId(configurationId: String?) = apply { + body.configurationId(configurationId) + } + + /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ + fun configurationId(configurationId: Optional) = + configurationId(configurationId.getOrNull()) + + /** + * Sets [Builder.configurationId] to an arbitrary JSON value. + * + * You should usually call [Builder.configurationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun configurationId(configurationId: JsonField) = apply { + body.configurationId(configurationId) + } + + /** Outbound webhook endpoints to notify on job status changes */ + fun webhookConfigurations(webhookConfigurations: List?) = apply { + body.webhookConfigurations(webhookConfigurations) + } + + /** + * Alias for calling [Builder.webhookConfigurations] with + * `webhookConfigurations.orElse(null)`. + */ + fun webhookConfigurations(webhookConfigurations: Optional>) = + webhookConfigurations(webhookConfigurations.getOrNull()) + + /** + * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. + * + * You should usually call [Builder.webhookConfigurations] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun webhookConfigurations(webhookConfigurations: JsonField>) = + apply { + body.webhookConfigurations(webhookConfigurations) + } + + /** + * Adds a single [WebhookConfiguration] to [webhookConfigurations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { + body.addWebhookConfiguration(webhookConfiguration) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SheetCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fileId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SheetCreateParams = + SheetCreateParams( + organizationId, + projectId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + organizationId?.let { put("organization_id", it) } + projectId?.let { put("project_id", it) } + putAll(additionalQueryParams) + } + .build() + + /** + * Request to create a spreadsheet parsing job. + * + * Provide at most one of `configuration` (inline) or `configuration_id` (saved preset). If + * neither is provided, a default inline configuration is used. + */ + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val fileId: JsonField, + private val config: JsonField, + private val configuration: JsonField, + private val configurationId: JsonField, + private val webhookConfigurations: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), + @JsonProperty("config") + @ExcludeMissing + config: JsonField = JsonMissing.of(), + @JsonProperty("configuration") + @ExcludeMissing + configuration: JsonField = JsonMissing.of(), + @JsonProperty("configuration_id") + @ExcludeMissing + configurationId: JsonField = JsonMissing.of(), + @JsonProperty("webhook_configurations") + @ExcludeMissing + webhookConfigurations: JsonField> = JsonMissing.of(), + ) : this( + fileId, + config, + configuration, + configurationId, + webhookConfigurations, + mutableMapOf(), + ) + + /** + * The ID of the file to parse + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fileId(): String = fileId.getRequired("file_id") + + /** + * Configuration for spreadsheet parsing and region extraction + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun config(): Optional = config.getOptional("config") + + /** + * Configuration for spreadsheet parsing and region extraction + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun configuration(): Optional = + configuration.getOptional("configuration") + + /** + * Saved configuration ID + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun configurationId(): Optional = configurationId.getOptional("configuration_id") + + /** + * Outbound webhook endpoints to notify on job status changes + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun webhookConfigurations(): Optional> = + webhookConfigurations.getOptional("webhook_configurations") + + /** + * Returns the raw JSON value of [fileId]. + * + * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") + @JsonProperty("config") + @ExcludeMissing + fun _config(): JsonField = config + + /** + * Returns the raw JSON value of [configuration]. + * + * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("configuration") + @ExcludeMissing + fun _configuration(): JsonField = configuration + + /** + * Returns the raw JSON value of [configurationId]. + * + * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("configuration_id") + @ExcludeMissing + fun _configurationId(): JsonField = configurationId + + /** + * Returns the raw JSON value of [webhookConfigurations]. + * + * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("webhook_configurations") + @ExcludeMissing + fun _webhookConfigurations(): JsonField> = webhookConfigurations + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .fileId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var fileId: JsonField? = null + private var config: JsonField = JsonMissing.of() + private var configuration: JsonField = JsonMissing.of() + private var configurationId: JsonField = JsonMissing.of() + private var webhookConfigurations: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + fileId = body.fileId + config = body.config + configuration = body.configuration + configurationId = body.configurationId + webhookConfigurations = body.webhookConfigurations.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The ID of the file to parse */ + fun fileId(fileId: String) = fileId(JsonField.of(fileId)) + + /** + * Sets [Builder.fileId] to an arbitrary JSON value. + * + * You should usually call [Builder.fileId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun fileId(fileId: JsonField) = apply { this.fileId = fileId } + + /** Configuration for spreadsheet parsing and region extraction */ + @Deprecated("deprecated") + fun config(config: SheetsParsingConfig?) = config(JsonField.ofNullable(config)) + + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ + @Deprecated("deprecated") + fun config(config: Optional) = config(config.getOrNull()) + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + @Deprecated("deprecated") + fun config(config: JsonField) = apply { this.config = config } + + /** Configuration for spreadsheet parsing and region extraction */ + fun configuration(configuration: SheetsParsingConfig?) = + configuration(JsonField.ofNullable(configuration)) + + /** Alias for calling [Builder.configuration] with `configuration.orElse(null)`. */ + fun configuration(configuration: Optional) = + configuration(configuration.getOrNull()) + + /** + * Sets [Builder.configuration] to an arbitrary JSON value. + * + * You should usually call [Builder.configuration] with a well-typed + * [SheetsParsingConfig] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun configuration(configuration: JsonField) = apply { + this.configuration = configuration + } + + /** Saved configuration ID */ + fun configurationId(configurationId: String?) = + configurationId(JsonField.ofNullable(configurationId)) + + /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ + fun configurationId(configurationId: Optional) = + configurationId(configurationId.getOrNull()) + + /** + * Sets [Builder.configurationId] to an arbitrary JSON value. + * + * You should usually call [Builder.configurationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun configurationId(configurationId: JsonField) = apply { + this.configurationId = configurationId + } + + /** Outbound webhook endpoints to notify on job status changes */ + fun webhookConfigurations(webhookConfigurations: List?) = + webhookConfigurations(JsonField.ofNullable(webhookConfigurations)) + + /** + * Alias for calling [Builder.webhookConfigurations] with + * `webhookConfigurations.orElse(null)`. + */ + fun webhookConfigurations(webhookConfigurations: Optional>) = + webhookConfigurations(webhookConfigurations.getOrNull()) + + /** + * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. + * + * You should usually call [Builder.webhookConfigurations] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun webhookConfigurations( + webhookConfigurations: JsonField> + ) = apply { + this.webhookConfigurations = webhookConfigurations.map { it.toMutableList() } + } + + /** + * Adds a single [WebhookConfiguration] to [webhookConfigurations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { + webhookConfigurations = + (webhookConfigurations ?: JsonField.of(mutableListOf())).also { + checkKnown("webhookConfigurations", it).add(webhookConfiguration) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fileId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("fileId", fileId), + config, + configuration, + configurationId, + (webhookConfigurations ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + fileId() + config().ifPresent { it.validate() } + configuration().ifPresent { it.validate() } + configurationId() + webhookConfigurations().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (fileId.asKnown().isPresent) 1 else 0) + + (config.asKnown().getOrNull()?.validity() ?: 0) + + (configuration.asKnown().getOrNull()?.validity() ?: 0) + + (if (configurationId.asKnown().isPresent) 1 else 0) + + (webhookConfigurations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + fileId == other.fileId && + config == other.config && + configuration == other.configuration && + configurationId == other.configurationId && + webhookConfigurations == other.webhookConfigurations && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + fileId, + config, + configuration, + configurationId, + webhookConfigurations, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{fileId=$fileId, config=$config, configuration=$configuration, configurationId=$configurationId, webhookConfigurations=$webhookConfigurations, additionalProperties=$additionalProperties}" + } + + /** Configuration for a single outbound webhook endpoint. */ + class WebhookConfiguration + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val webhookEvents: JsonField>, + private val webhookHeaders: JsonField, + private val webhookOutputFormat: JsonField, + private val webhookUrl: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("webhook_events") + @ExcludeMissing + webhookEvents: JsonField> = JsonMissing.of(), + @JsonProperty("webhook_headers") + @ExcludeMissing + webhookHeaders: JsonField = JsonMissing.of(), + @JsonProperty("webhook_output_format") + @ExcludeMissing + webhookOutputFormat: JsonField = JsonMissing.of(), + @JsonProperty("webhook_url") + @ExcludeMissing + webhookUrl: JsonField = JsonMissing.of(), + ) : this(webhookEvents, webhookHeaders, webhookOutputFormat, webhookUrl, mutableMapOf()) + + /** + * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events are + * delivered. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun webhookEvents(): Optional> = + webhookEvents.getOptional("webhook_events") + + /** + * Custom HTTP headers sent with each webhook request (e.g. auth tokens) + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun webhookHeaders(): Optional = + webhookHeaders.getOptional("webhook_headers") + + /** + * Response format sent to the webhook: 'string' (default) or 'json' + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun webhookOutputFormat(): Optional = + webhookOutputFormat.getOptional("webhook_output_format") + + /** + * URL to receive webhook POST notifications + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun webhookUrl(): Optional = webhookUrl.getOptional("webhook_url") + + /** + * Returns the raw JSON value of [webhookEvents]. + * + * Unlike [webhookEvents], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("webhook_events") + @ExcludeMissing + fun _webhookEvents(): JsonField> = webhookEvents + + /** + * Returns the raw JSON value of [webhookHeaders]. + * + * Unlike [webhookHeaders], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("webhook_headers") + @ExcludeMissing + fun _webhookHeaders(): JsonField = webhookHeaders + + /** + * Returns the raw JSON value of [webhookOutputFormat]. + * + * Unlike [webhookOutputFormat], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("webhook_output_format") + @ExcludeMissing + fun _webhookOutputFormat(): JsonField = webhookOutputFormat + + /** + * Returns the raw JSON value of [webhookUrl]. + * + * Unlike [webhookUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("webhook_url") + @ExcludeMissing + fun _webhookUrl(): JsonField = webhookUrl + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [WebhookConfiguration]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [WebhookConfiguration]. */ + class Builder internal constructor() { + + private var webhookEvents: JsonField>? = null + private var webhookHeaders: JsonField = JsonMissing.of() + private var webhookOutputFormat: JsonField = JsonMissing.of() + private var webhookUrl: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(webhookConfiguration: WebhookConfiguration) = apply { + webhookEvents = webhookConfiguration.webhookEvents.map { it.toMutableList() } + webhookHeaders = webhookConfiguration.webhookHeaders + webhookOutputFormat = webhookConfiguration.webhookOutputFormat + webhookUrl = webhookConfiguration.webhookUrl + additionalProperties = webhookConfiguration.additionalProperties.toMutableMap() + } + + /** + * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events + * are delivered. + */ + fun webhookEvents(webhookEvents: List?) = + webhookEvents(JsonField.ofNullable(webhookEvents)) + + /** Alias for calling [Builder.webhookEvents] with `webhookEvents.orElse(null)`. */ + fun webhookEvents(webhookEvents: Optional>) = + webhookEvents(webhookEvents.getOrNull()) + + /** + * Sets [Builder.webhookEvents] to an arbitrary JSON value. + * + * You should usually call [Builder.webhookEvents] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun webhookEvents(webhookEvents: JsonField>) = apply { + this.webhookEvents = webhookEvents.map { it.toMutableList() } + } + + /** + * Adds a single [WebhookEvent] to [webhookEvents]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addWebhookEvent(webhookEvent: WebhookEvent) = apply { + webhookEvents = + (webhookEvents ?: JsonField.of(mutableListOf())).also { + checkKnown("webhookEvents", it).add(webhookEvent) + } + } + + /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ + fun webhookHeaders(webhookHeaders: WebhookHeaders?) = + webhookHeaders(JsonField.ofNullable(webhookHeaders)) + + /** Alias for calling [Builder.webhookHeaders] with `webhookHeaders.orElse(null)`. */ + fun webhookHeaders(webhookHeaders: Optional) = + webhookHeaders(webhookHeaders.getOrNull()) + + /** + * Sets [Builder.webhookHeaders] to an arbitrary JSON value. + * + * You should usually call [Builder.webhookHeaders] with a well-typed [WebhookHeaders] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun webhookHeaders(webhookHeaders: JsonField) = apply { + this.webhookHeaders = webhookHeaders + } + + /** Response format sent to the webhook: 'string' (default) or 'json' */ + fun webhookOutputFormat(webhookOutputFormat: String?) = + webhookOutputFormat(JsonField.ofNullable(webhookOutputFormat)) + + /** + * Alias for calling [Builder.webhookOutputFormat] with + * `webhookOutputFormat.orElse(null)`. + */ + fun webhookOutputFormat(webhookOutputFormat: Optional) = + webhookOutputFormat(webhookOutputFormat.getOrNull()) + + /** + * Sets [Builder.webhookOutputFormat] to an arbitrary JSON value. + * + * You should usually call [Builder.webhookOutputFormat] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun webhookOutputFormat(webhookOutputFormat: JsonField) = apply { + this.webhookOutputFormat = webhookOutputFormat + } + + /** URL to receive webhook POST notifications */ + fun webhookUrl(webhookUrl: String?) = webhookUrl(JsonField.ofNullable(webhookUrl)) + + /** Alias for calling [Builder.webhookUrl] with `webhookUrl.orElse(null)`. */ + fun webhookUrl(webhookUrl: Optional) = webhookUrl(webhookUrl.getOrNull()) + + /** + * Sets [Builder.webhookUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.webhookUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun webhookUrl(webhookUrl: JsonField) = apply { this.webhookUrl = webhookUrl } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [WebhookConfiguration]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): WebhookConfiguration = + WebhookConfiguration( + (webhookEvents ?: JsonMissing.of()).map { it.toImmutable() }, + webhookHeaders, + webhookOutputFormat, + webhookUrl, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): WebhookConfiguration = apply { + if (validated) { + return@apply + } + + webhookEvents().ifPresent { it.forEach { it.validate() } } + webhookHeaders().ifPresent { it.validate() } + webhookOutputFormat() + webhookUrl() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (webhookEvents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (webhookHeaders.asKnown().getOrNull()?.validity() ?: 0) + + (if (webhookOutputFormat.asKnown().isPresent) 1 else 0) + + (if (webhookUrl.asKnown().isPresent) 1 else 0) + + class WebhookEvent @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EXTRACT_PENDING = of("extract.pending") + + @JvmField val EXTRACT_SUCCESS = of("extract.success") + + @JvmField val EXTRACT_ERROR = of("extract.error") + + @JvmField val EXTRACT_PARTIAL_SUCCESS = of("extract.partial_success") + + @JvmField val EXTRACT_CANCELLED = of("extract.cancelled") + + @JvmField val PARSE_PENDING = of("parse.pending") + + @JvmField val PARSE_RUNNING = of("parse.running") + + @JvmField val PARSE_SUCCESS = of("parse.success") + + @JvmField val PARSE_ERROR = of("parse.error") + + @JvmField val PARSE_PARTIAL_SUCCESS = of("parse.partial_success") + + @JvmField val PARSE_CANCELLED = of("parse.cancelled") + + @JvmField val CLASSIFY_PENDING = of("classify.pending") + + @JvmField val CLASSIFY_RUNNING = of("classify.running") + + @JvmField val CLASSIFY_SUCCESS = of("classify.success") + + @JvmField val CLASSIFY_ERROR = of("classify.error") + + @JvmField val CLASSIFY_PARTIAL_SUCCESS = of("classify.partial_success") + + @JvmField val CLASSIFY_CANCELLED = of("classify.cancelled") + + @JvmField val SHEETS_PENDING = of("sheets.pending") + + @JvmField val SHEETS_SUCCESS = of("sheets.success") + + @JvmField val SHEETS_ERROR = of("sheets.error") + + @JvmField val SHEETS_PARTIAL_SUCCESS = of("sheets.partial_success") + + @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") + + @JvmField val SPLIT_PENDING = of("split.pending") + + @JvmField val SPLIT_PROCESSING = of("split.processing") + + @JvmField val SPLIT_SUCCESS = of("split.success") + + @JvmField val SPLIT_ERROR = of("split.error") + + @JvmField val SPLIT_CANCELLED = of("split.cancelled") + + @JvmField val UNMAPPED_EVENT = of("unmapped_event") + + @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) + } + + /** An enum containing [WebhookEvent]'s known values. */ + enum class Known { + EXTRACT_PENDING, + EXTRACT_SUCCESS, + EXTRACT_ERROR, + EXTRACT_PARTIAL_SUCCESS, + EXTRACT_CANCELLED, + PARSE_PENDING, + PARSE_RUNNING, + PARSE_SUCCESS, + PARSE_ERROR, + PARSE_PARTIAL_SUCCESS, + PARSE_CANCELLED, + CLASSIFY_PENDING, + CLASSIFY_RUNNING, + CLASSIFY_SUCCESS, + CLASSIFY_ERROR, + CLASSIFY_PARTIAL_SUCCESS, + CLASSIFY_CANCELLED, + SHEETS_PENDING, + SHEETS_SUCCESS, + SHEETS_ERROR, + SHEETS_PARTIAL_SUCCESS, + SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, + UNMAPPED_EVENT, + } + + /** + * An enum containing [WebhookEvent]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [WebhookEvent] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EXTRACT_PENDING, + EXTRACT_SUCCESS, + EXTRACT_ERROR, + EXTRACT_PARTIAL_SUCCESS, + EXTRACT_CANCELLED, + PARSE_PENDING, + PARSE_RUNNING, + PARSE_SUCCESS, + PARSE_ERROR, + PARSE_PARTIAL_SUCCESS, + PARSE_CANCELLED, + CLASSIFY_PENDING, + CLASSIFY_RUNNING, + CLASSIFY_SUCCESS, + CLASSIFY_ERROR, + CLASSIFY_PARTIAL_SUCCESS, + CLASSIFY_CANCELLED, + SHEETS_PENDING, + SHEETS_SUCCESS, + SHEETS_ERROR, + SHEETS_PARTIAL_SUCCESS, + SHEETS_CANCELLED, + SPLIT_PENDING, + SPLIT_PROCESSING, + SPLIT_SUCCESS, + SPLIT_ERROR, + SPLIT_CANCELLED, + UNMAPPED_EVENT, + /** + * An enum member indicating that [WebhookEvent] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EXTRACT_PENDING -> Value.EXTRACT_PENDING + EXTRACT_SUCCESS -> Value.EXTRACT_SUCCESS + EXTRACT_ERROR -> Value.EXTRACT_ERROR + EXTRACT_PARTIAL_SUCCESS -> Value.EXTRACT_PARTIAL_SUCCESS + EXTRACT_CANCELLED -> Value.EXTRACT_CANCELLED + PARSE_PENDING -> Value.PARSE_PENDING + PARSE_RUNNING -> Value.PARSE_RUNNING + PARSE_SUCCESS -> Value.PARSE_SUCCESS + PARSE_ERROR -> Value.PARSE_ERROR + PARSE_PARTIAL_SUCCESS -> Value.PARSE_PARTIAL_SUCCESS + PARSE_CANCELLED -> Value.PARSE_CANCELLED + CLASSIFY_PENDING -> Value.CLASSIFY_PENDING + CLASSIFY_RUNNING -> Value.CLASSIFY_RUNNING + CLASSIFY_SUCCESS -> Value.CLASSIFY_SUCCESS + CLASSIFY_ERROR -> Value.CLASSIFY_ERROR + CLASSIFY_PARTIAL_SUCCESS -> Value.CLASSIFY_PARTIAL_SUCCESS + CLASSIFY_CANCELLED -> Value.CLASSIFY_CANCELLED + SHEETS_PENDING -> Value.SHEETS_PENDING + SHEETS_SUCCESS -> Value.SHEETS_SUCCESS + SHEETS_ERROR -> Value.SHEETS_ERROR + SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS + SHEETS_CANCELLED -> Value.SHEETS_CANCELLED + SPLIT_PENDING -> Value.SPLIT_PENDING + SPLIT_PROCESSING -> Value.SPLIT_PROCESSING + SPLIT_SUCCESS -> Value.SPLIT_SUCCESS + SPLIT_ERROR -> Value.SPLIT_ERROR + SPLIT_CANCELLED -> Value.SPLIT_CANCELLED + UNMAPPED_EVENT -> Value.UNMAPPED_EVENT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + EXTRACT_PENDING -> Known.EXTRACT_PENDING + EXTRACT_SUCCESS -> Known.EXTRACT_SUCCESS + EXTRACT_ERROR -> Known.EXTRACT_ERROR + EXTRACT_PARTIAL_SUCCESS -> Known.EXTRACT_PARTIAL_SUCCESS + EXTRACT_CANCELLED -> Known.EXTRACT_CANCELLED + PARSE_PENDING -> Known.PARSE_PENDING + PARSE_RUNNING -> Known.PARSE_RUNNING + PARSE_SUCCESS -> Known.PARSE_SUCCESS + PARSE_ERROR -> Known.PARSE_ERROR + PARSE_PARTIAL_SUCCESS -> Known.PARSE_PARTIAL_SUCCESS + PARSE_CANCELLED -> Known.PARSE_CANCELLED + CLASSIFY_PENDING -> Known.CLASSIFY_PENDING + CLASSIFY_RUNNING -> Known.CLASSIFY_RUNNING + CLASSIFY_SUCCESS -> Known.CLASSIFY_SUCCESS + CLASSIFY_ERROR -> Known.CLASSIFY_ERROR + CLASSIFY_PARTIAL_SUCCESS -> Known.CLASSIFY_PARTIAL_SUCCESS + CLASSIFY_CANCELLED -> Known.CLASSIFY_CANCELLED + SHEETS_PENDING -> Known.SHEETS_PENDING + SHEETS_SUCCESS -> Known.SHEETS_SUCCESS + SHEETS_ERROR -> Known.SHEETS_ERROR + SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS + SHEETS_CANCELLED -> Known.SHEETS_CANCELLED + SPLIT_PENDING -> Known.SPLIT_PENDING + SPLIT_PROCESSING -> Known.SPLIT_PROCESSING + SPLIT_SUCCESS -> Known.SPLIT_SUCCESS + SPLIT_ERROR -> Known.SPLIT_ERROR + SPLIT_CANCELLED -> Known.SPLIT_CANCELLED + UNMAPPED_EVENT -> Known.UNMAPPED_EVENT + else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): WebhookEvent = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is WebhookEvent && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ + class WebhookHeaders + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [WebhookHeaders]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [WebhookHeaders]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(webhookHeaders: WebhookHeaders) = apply { + additionalProperties = webhookHeaders.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [WebhookHeaders]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): WebhookHeaders = WebhookHeaders(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): WebhookHeaders = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is WebhookHeaders && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "WebhookHeaders{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is WebhookConfiguration && + webhookEvents == other.webhookEvents && + webhookHeaders == other.webhookHeaders && + webhookOutputFormat == other.webhookOutputFormat && + webhookUrl == other.webhookUrl && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + webhookEvents, + webhookHeaders, + webhookOutputFormat, + webhookUrl, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "WebhookConfiguration{webhookEvents=$webhookEvents, webhookHeaders=$webhookHeaders, webhookOutputFormat=$webhookOutputFormat, webhookUrl=$webhookUrl, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetCreateParams && + organizationId == other.organizationId && + projectId == other.projectId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(organizationId, projectId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "SheetCreateParams{organizationId=$organizationId, projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParams.kt new file mode 100644 index 0000000..dbf4eeb --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParams.kt @@ -0,0 +1,271 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.core.Params +import com.llamacloud_prod.api.core.http.Headers +import com.llamacloud_prod.api.core.http.QueryParams +import com.llamacloud_prod.api.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Delete a spreadsheet parsing job and its associated data. */ +class SheetDeleteJobParams +private constructor( + private val spreadsheetJobId: String?, + private val organizationId: String?, + private val projectId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun spreadsheetJobId(): Optional = Optional.ofNullable(spreadsheetJobId) + + fun organizationId(): Optional = Optional.ofNullable(organizationId) + + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SheetDeleteJobParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SheetDeleteJobParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetDeleteJobParams]. */ + class Builder internal constructor() { + + private var spreadsheetJobId: String? = null + private var organizationId: String? = null + private var projectId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sheetDeleteJobParams: SheetDeleteJobParams) = apply { + spreadsheetJobId = sheetDeleteJobParams.spreadsheetJobId + organizationId = sheetDeleteJobParams.organizationId + projectId = sheetDeleteJobParams.projectId + additionalHeaders = sheetDeleteJobParams.additionalHeaders.toBuilder() + additionalQueryParams = sheetDeleteJobParams.additionalQueryParams.toBuilder() + additionalBodyProperties = sheetDeleteJobParams.additionalBodyProperties.toMutableMap() + } + + fun spreadsheetJobId(spreadsheetJobId: String?) = apply { + this.spreadsheetJobId = spreadsheetJobId + } + + /** Alias for calling [Builder.spreadsheetJobId] with `spreadsheetJobId.orElse(null)`. */ + fun spreadsheetJobId(spreadsheetJobId: Optional) = + spreadsheetJobId(spreadsheetJobId.getOrNull()) + + fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } + + /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ + fun organizationId(organizationId: Optional) = + organizationId(organizationId.getOrNull()) + + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [SheetDeleteJobParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SheetDeleteJobParams = + SheetDeleteJobParams( + spreadsheetJobId, + organizationId, + projectId, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> spreadsheetJobId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + organizationId?.let { put("organization_id", it) } + projectId?.let { put("project_id", it) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetDeleteJobParams && + spreadsheetJobId == other.spreadsheetJobId && + organizationId == other.organizationId && + projectId == other.projectId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash( + spreadsheetJobId, + organizationId, + projectId, + additionalHeaders, + additionalQueryParams, + additionalBodyProperties, + ) + + override fun toString() = + "SheetDeleteJobParams{spreadsheetJobId=$spreadsheetJobId, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponse.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponse.kt new file mode 100644 index 0000000..ebeba75 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponse.kt @@ -0,0 +1,122 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.llamacloud_prod.api.core.ExcludeMissing +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.errors.LlamaCloudInvalidDataException +import java.util.Collections +import java.util.Objects + +class SheetDeleteJobResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [SheetDeleteJobResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetDeleteJobResponse]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sheetDeleteJobResponse: SheetDeleteJobResponse) = apply { + additionalProperties = sheetDeleteJobResponse.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SheetDeleteJobResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SheetDeleteJobResponse = + SheetDeleteJobResponse(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SheetDeleteJobResponse = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetDeleteJobResponse && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "SheetDeleteJobResponse{additionalProperties=$additionalProperties}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParams.kt new file mode 100644 index 0000000..454fcef --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParams.kt @@ -0,0 +1,290 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.Params +import com.llamacloud_prod.api.core.http.Headers +import com.llamacloud_prod.api.core.http.QueryParams +import com.llamacloud_prod.api.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted regions + * and results if complete, skipping the separate `/results` call. + */ +class SheetGetParams +private constructor( + private val spreadsheetJobId: String?, + private val expand: List?, + private val includeResults: Boolean?, + private val organizationId: String?, + private val projectId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun spreadsheetJobId(): Optional = Optional.ofNullable(spreadsheetJobId) + + /** Optional fields to populate on the response. Valid values: metadata_state_transitions. */ + fun expand(): Optional> = Optional.ofNullable(expand) + + fun includeResults(): Optional = Optional.ofNullable(includeResults) + + fun organizationId(): Optional = Optional.ofNullable(organizationId) + + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SheetGetParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SheetGetParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetGetParams]. */ + class Builder internal constructor() { + + private var spreadsheetJobId: String? = null + private var expand: MutableList? = null + private var includeResults: Boolean? = null + private var organizationId: String? = null + private var projectId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sheetGetParams: SheetGetParams) = apply { + spreadsheetJobId = sheetGetParams.spreadsheetJobId + expand = sheetGetParams.expand?.toMutableList() + includeResults = sheetGetParams.includeResults + organizationId = sheetGetParams.organizationId + projectId = sheetGetParams.projectId + additionalHeaders = sheetGetParams.additionalHeaders.toBuilder() + additionalQueryParams = sheetGetParams.additionalQueryParams.toBuilder() + } + + fun spreadsheetJobId(spreadsheetJobId: String?) = apply { + this.spreadsheetJobId = spreadsheetJobId + } + + /** Alias for calling [Builder.spreadsheetJobId] with `spreadsheetJobId.orElse(null)`. */ + fun spreadsheetJobId(spreadsheetJobId: Optional) = + spreadsheetJobId(spreadsheetJobId.getOrNull()) + + /** + * Optional fields to populate on the response. Valid values: metadata_state_transitions. + */ + fun expand(expand: List?) = apply { this.expand = expand?.toMutableList() } + + /** Alias for calling [Builder.expand] with `expand.orElse(null)`. */ + fun expand(expand: Optional>) = expand(expand.getOrNull()) + + /** + * Adds a single [String] to [Builder.expand]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExpand(expand: String) = apply { + this.expand = (this.expand ?: mutableListOf()).apply { add(expand) } + } + + fun includeResults(includeResults: Boolean?) = apply { + this.includeResults = includeResults + } + + /** + * Alias for [Builder.includeResults]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) + + /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ + fun includeResults(includeResults: Optional) = + includeResults(includeResults.getOrNull()) + + fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } + + /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ + fun organizationId(organizationId: Optional) = + organizationId(organizationId.getOrNull()) + + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SheetGetParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SheetGetParams = + SheetGetParams( + spreadsheetJobId, + expand?.toImmutable(), + includeResults, + organizationId, + projectId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> spreadsheetJobId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + expand?.forEach { put("expand", it) } + includeResults?.let { put("include_results", it.toString()) } + organizationId?.let { put("organization_id", it) } + projectId?.let { put("project_id", it) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetGetParams && + spreadsheetJobId == other.spreadsheetJobId && + expand == other.expand && + includeResults == other.includeResults && + organizationId == other.organizationId && + projectId == other.projectId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + spreadsheetJobId, + expand, + includeResults, + organizationId, + projectId, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "SheetGetParams{spreadsheetJobId=$spreadsheetJobId, expand=$expand, includeResults=$includeResults, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParams.kt new file mode 100644 index 0000000..0a01d92 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParams.kt @@ -0,0 +1,443 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.fasterxml.jackson.annotation.JsonCreator +import com.llamacloud_prod.api.core.Enum +import com.llamacloud_prod.api.core.JsonField +import com.llamacloud_prod.api.core.Params +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.core.http.Headers +import com.llamacloud_prod.api.core.http.QueryParams +import com.llamacloud_prod.api.errors.LlamaCloudInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Generate a presigned URL to download a specific extracted region. */ +class SheetGetResultTableParams +private constructor( + private val spreadsheetJobId: String, + private val regionId: String, + private val regionType: RegionType?, + private val expiresAtSeconds: Long?, + private val organizationId: String?, + private val projectId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun spreadsheetJobId(): String = spreadsheetJobId + + fun regionId(): String = regionId + + fun regionType(): Optional = Optional.ofNullable(regionType) + + fun expiresAtSeconds(): Optional = Optional.ofNullable(expiresAtSeconds) + + fun organizationId(): Optional = Optional.ofNullable(organizationId) + + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SheetGetResultTableParams]. + * + * The following fields are required: + * ```java + * .spreadsheetJobId() + * .regionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetGetResultTableParams]. */ + class Builder internal constructor() { + + private var spreadsheetJobId: String? = null + private var regionId: String? = null + private var regionType: RegionType? = null + private var expiresAtSeconds: Long? = null + private var organizationId: String? = null + private var projectId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sheetGetResultTableParams: SheetGetResultTableParams) = apply { + spreadsheetJobId = sheetGetResultTableParams.spreadsheetJobId + regionId = sheetGetResultTableParams.regionId + regionType = sheetGetResultTableParams.regionType + expiresAtSeconds = sheetGetResultTableParams.expiresAtSeconds + organizationId = sheetGetResultTableParams.organizationId + projectId = sheetGetResultTableParams.projectId + additionalHeaders = sheetGetResultTableParams.additionalHeaders.toBuilder() + additionalQueryParams = sheetGetResultTableParams.additionalQueryParams.toBuilder() + } + + fun spreadsheetJobId(spreadsheetJobId: String) = apply { + this.spreadsheetJobId = spreadsheetJobId + } + + fun regionId(regionId: String) = apply { this.regionId = regionId } + + fun regionType(regionType: RegionType?) = apply { this.regionType = regionType } + + /** Alias for calling [Builder.regionType] with `regionType.orElse(null)`. */ + fun regionType(regionType: Optional) = regionType(regionType.getOrNull()) + + fun expiresAtSeconds(expiresAtSeconds: Long?) = apply { + this.expiresAtSeconds = expiresAtSeconds + } + + /** + * Alias for [Builder.expiresAtSeconds]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun expiresAtSeconds(expiresAtSeconds: Long) = expiresAtSeconds(expiresAtSeconds as Long?) + + /** Alias for calling [Builder.expiresAtSeconds] with `expiresAtSeconds.orElse(null)`. */ + fun expiresAtSeconds(expiresAtSeconds: Optional) = + expiresAtSeconds(expiresAtSeconds.getOrNull()) + + fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } + + /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ + fun organizationId(organizationId: Optional) = + organizationId(organizationId.getOrNull()) + + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SheetGetResultTableParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .spreadsheetJobId() + * .regionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SheetGetResultTableParams = + SheetGetResultTableParams( + checkRequired("spreadsheetJobId", spreadsheetJobId), + checkRequired("regionId", regionId), + regionType, + expiresAtSeconds, + organizationId, + projectId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> spreadsheetJobId + 1 -> regionId + 2 -> regionType?.toString() ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + expiresAtSeconds?.let { put("expires_at_seconds", it.toString()) } + organizationId?.let { put("organization_id", it) } + projectId?.let { put("project_id", it) } + putAll(additionalQueryParams) + } + .build() + + class RegionType @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TABLE = of("table") + + @JvmField val EXTRA = of("extra") + + @JvmField val CELL_METADATA = of("cell_metadata") + + @JvmStatic fun of(value: String) = RegionType(JsonField.of(value)) + } + + /** An enum containing [RegionType]'s known values. */ + enum class Known { + TABLE, + EXTRA, + CELL_METADATA, + } + + /** + * An enum containing [RegionType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [RegionType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TABLE, + EXTRA, + CELL_METADATA, + /** + * An enum member indicating that [RegionType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TABLE -> Value.TABLE + EXTRA -> Value.EXTRA + CELL_METADATA -> Value.CELL_METADATA + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TABLE -> Known.TABLE + EXTRA -> Known.EXTRA + CELL_METADATA -> Known.CELL_METADATA + else -> throw LlamaCloudInvalidDataException("Unknown RegionType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RegionType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RegionType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetGetResultTableParams && + spreadsheetJobId == other.spreadsheetJobId && + regionId == other.regionId && + regionType == other.regionType && + expiresAtSeconds == other.expiresAtSeconds && + organizationId == other.organizationId && + projectId == other.projectId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + spreadsheetJobId, + regionId, + regionType, + expiresAtSeconds, + organizationId, + projectId, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "SheetGetResultTableParams{spreadsheetJobId=$spreadsheetJobId, regionId=$regionId, regionType=$regionType, expiresAtSeconds=$expiresAtSeconds, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPage.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPage.kt new file mode 100644 index 0000000..aafbba4 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPage.kt @@ -0,0 +1,131 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.AutoPager +import com.llamacloud_prod.api.core.Page +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.services.blocking.SheetService +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** @see SheetService.list */ +class SheetListPage +private constructor( + private val service: SheetService, + private val params: SheetListParams, + private val response: SheetListPageResponse, +) : Page { + + /** + * Delegates to [SheetListPageResponse], but gracefully handles missing data. + * + * @see SheetListPageResponse.items + */ + override fun items(): List = + response._items().getOptional("items").getOrNull() ?: emptyList() + + /** + * Delegates to [SheetListPageResponse], but gracefully handles missing data. + * + * @see SheetListPageResponse.nextPageToken + */ + fun nextPageToken(): Optional = response._nextPageToken().getOptional("next_page_token") + + override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageToken().isPresent + + fun nextPageParams(): SheetListParams { + val nextCursor = + nextPageToken().getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().pageToken(nextCursor).build() + } + + override fun nextPage(): SheetListPage = service.list(nextPageParams()) + + fun autoPager(): AutoPager = AutoPager.from(this) + + /** The parameters that were used to request this page. */ + fun params(): SheetListParams = params + + /** The response that this page was parsed from. */ + fun response(): SheetListPageResponse = response + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SheetListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetListPage]. */ + class Builder internal constructor() { + + private var service: SheetService? = null + private var params: SheetListParams? = null + private var response: SheetListPageResponse? = null + + @JvmSynthetic + internal fun from(sheetListPage: SheetListPage) = apply { + service = sheetListPage.service + params = sheetListPage.params + response = sheetListPage.response + } + + fun service(service: SheetService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: SheetListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: SheetListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [SheetListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SheetListPage = + SheetListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetListPage && + service == other.service && + params == other.params && + response == other.response + } + + override fun hashCode(): Int = Objects.hash(service, params, response) + + override fun toString() = "SheetListPage{service=$service, params=$params, response=$response}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageAsync.kt new file mode 100644 index 0000000..6ae2d92 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageAsync.kt @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.AutoPagerAsync +import com.llamacloud_prod.api.core.PageAsync +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.services.async.SheetServiceAsync +import java.util.Objects +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor +import kotlin.jvm.optionals.getOrNull + +/** @see SheetServiceAsync.list */ +class SheetListPageAsync +private constructor( + private val service: SheetServiceAsync, + private val streamHandlerExecutor: Executor, + private val params: SheetListParams, + private val response: SheetListPageResponse, +) : PageAsync { + + /** + * Delegates to [SheetListPageResponse], but gracefully handles missing data. + * + * @see SheetListPageResponse.items + */ + override fun items(): List = + response._items().getOptional("items").getOrNull() ?: emptyList() + + /** + * Delegates to [SheetListPageResponse], but gracefully handles missing data. + * + * @see SheetListPageResponse.nextPageToken + */ + fun nextPageToken(): Optional = response._nextPageToken().getOptional("next_page_token") + + override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageToken().isPresent + + fun nextPageParams(): SheetListParams { + val nextCursor = + nextPageToken().getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().pageToken(nextCursor).build() + } + + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) + + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) + + /** The parameters that were used to request this page. */ + fun params(): SheetListParams = params + + /** The response that this page was parsed from. */ + fun response(): SheetListPageResponse = response + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SheetListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .streamHandlerExecutor() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetListPageAsync]. */ + class Builder internal constructor() { + + private var service: SheetServiceAsync? = null + private var streamHandlerExecutor: Executor? = null + private var params: SheetListParams? = null + private var response: SheetListPageResponse? = null + + @JvmSynthetic + internal fun from(sheetListPageAsync: SheetListPageAsync) = apply { + service = sheetListPageAsync.service + streamHandlerExecutor = sheetListPageAsync.streamHandlerExecutor + params = sheetListPageAsync.params + response = sheetListPageAsync.response + } + + fun service(service: SheetServiceAsync) = apply { this.service = service } + + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + + /** The parameters that were used to request this page. */ + fun params(params: SheetListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: SheetListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [SheetListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .streamHandlerExecutor() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SheetListPageAsync = + SheetListPageAsync( + checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), + checkRequired("params", params), + checkRequired("response", response), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetListPageAsync && + service == other.service && + streamHandlerExecutor == other.streamHandlerExecutor && + params == other.params && + response == other.response + } + + override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) + + override fun toString() = + "SheetListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponse.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponse.kt new file mode 100644 index 0000000..baccc7f --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponse.kt @@ -0,0 +1,301 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +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.llamacloud_prod.api.core.ExcludeMissing +import com.llamacloud_prod.api.core.JsonField +import com.llamacloud_prod.api.core.JsonMissing +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.core.checkKnown +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.core.toImmutable +import com.llamacloud_prod.api.errors.LlamaCloudInvalidDataException +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class SheetListPageResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val nextPageToken: JsonField, + private val totalSize: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), + @JsonProperty("next_page_token") + @ExcludeMissing + nextPageToken: JsonField = JsonMissing.of(), + @JsonProperty("total_size") @ExcludeMissing totalSize: JsonField = JsonMissing.of(), + ) : this(items, nextPageToken, totalSize, mutableMapOf()) + + /** + * The list of items. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * A token, which can be sent as page_token to retrieve the next page. If this field is omitted, + * there are no subsequent pages. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun nextPageToken(): Optional = nextPageToken.getOptional("next_page_token") + + /** + * The total number of items available. This is only populated when specifically requested. The + * value may be an estimate and can be used for display purposes only. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun totalSize(): Optional = totalSize.getOptional("total_size") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + /** + * Returns the raw JSON value of [nextPageToken]. + * + * Unlike [nextPageToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("next_page_token") + @ExcludeMissing + fun _nextPageToken(): JsonField = nextPageToken + + /** + * Returns the raw JSON value of [totalSize]. + * + * Unlike [totalSize], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total_size") @ExcludeMissing fun _totalSize(): JsonField = totalSize + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SheetListPageResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetListPageResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var nextPageToken: JsonField = JsonMissing.of() + private var totalSize: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sheetListPageResponse: SheetListPageResponse) = apply { + items = sheetListPageResponse.items.map { it.toMutableList() } + nextPageToken = sheetListPageResponse.nextPageToken + totalSize = sheetListPageResponse.totalSize + additionalProperties = sheetListPageResponse.additionalProperties.toMutableMap() + } + + /** The list of items. */ + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [SheetsJob] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: SheetsJob) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + /** + * A token, which can be sent as page_token to retrieve the next page. If this field is + * omitted, there are no subsequent pages. + */ + fun nextPageToken(nextPageToken: String?) = + nextPageToken(JsonField.ofNullable(nextPageToken)) + + /** Alias for calling [Builder.nextPageToken] with `nextPageToken.orElse(null)`. */ + fun nextPageToken(nextPageToken: Optional) = + nextPageToken(nextPageToken.getOrNull()) + + /** + * Sets [Builder.nextPageToken] to an arbitrary JSON value. + * + * You should usually call [Builder.nextPageToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun nextPageToken(nextPageToken: JsonField) = apply { + this.nextPageToken = nextPageToken + } + + /** + * The total number of items available. This is only populated when specifically requested. + * The value may be an estimate and can be used for display purposes only. + */ + fun totalSize(totalSize: Long?) = totalSize(JsonField.ofNullable(totalSize)) + + /** + * Alias for [Builder.totalSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun totalSize(totalSize: Long) = totalSize(totalSize as Long?) + + /** Alias for calling [Builder.totalSize] with `totalSize.orElse(null)`. */ + fun totalSize(totalSize: Optional) = totalSize(totalSize.getOrNull()) + + /** + * Sets [Builder.totalSize] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSize] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun totalSize(totalSize: JsonField) = apply { this.totalSize = totalSize } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SheetListPageResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SheetListPageResponse = + SheetListPageResponse( + checkRequired("items", items).map { it.toImmutable() }, + nextPageToken, + totalSize, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SheetListPageResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + nextPageToken() + totalSize() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (nextPageToken.asKnown().isPresent) 1 else 0) + + (if (totalSize.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetListPageResponse && + items == other.items && + nextPageToken == other.nextPageToken && + totalSize == other.totalSize && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(items, nextPageToken, totalSize, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SheetListPageResponse{items=$items, nextPageToken=$nextPageToken, totalSize=$totalSize, additionalProperties=$additionalProperties}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParams.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParams.kt new file mode 100644 index 0000000..72cce58 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParams.kt @@ -0,0 +1,543 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.fasterxml.jackson.annotation.JsonCreator +import com.llamacloud_prod.api.core.Enum +import com.llamacloud_prod.api.core.JsonField +import com.llamacloud_prod.api.core.Params +import com.llamacloud_prod.api.core.http.Headers +import com.llamacloud_prod.api.core.http.QueryParams +import com.llamacloud_prod.api.core.toImmutable +import com.llamacloud_prod.api.errors.LlamaCloudInvalidDataException +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** List spreadsheet parsing jobs. */ +class SheetListParams +private constructor( + private val configurationId: String?, + private val createdAtOnOrAfter: OffsetDateTime?, + private val createdAtOnOrBefore: OffsetDateTime?, + private val includeResults: Boolean?, + private val jobIds: List?, + private val organizationId: String?, + private val pageSize: Long?, + private val pageToken: String?, + private val projectId: String?, + private val status: Status?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** Filter by saved configuration ID */ + fun configurationId(): Optional = Optional.ofNullable(configurationId) + + /** Include items created at or after this timestamp (inclusive) */ + fun createdAtOnOrAfter(): Optional = Optional.ofNullable(createdAtOnOrAfter) + + /** Include items created at or before this timestamp (inclusive) */ + fun createdAtOnOrBefore(): Optional = Optional.ofNullable(createdAtOnOrBefore) + + fun includeResults(): Optional = Optional.ofNullable(includeResults) + + /** Filter by specific job IDs */ + fun jobIds(): Optional> = Optional.ofNullable(jobIds) + + fun organizationId(): Optional = Optional.ofNullable(organizationId) + + fun pageSize(): Optional = Optional.ofNullable(pageSize) + + fun pageToken(): Optional = Optional.ofNullable(pageToken) + + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Filter by job status */ + fun status(): Optional = Optional.ofNullable(status) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SheetListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SheetListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SheetListParams]. */ + class Builder internal constructor() { + + private var configurationId: String? = null + private var createdAtOnOrAfter: OffsetDateTime? = null + private var createdAtOnOrBefore: OffsetDateTime? = null + private var includeResults: Boolean? = null + private var jobIds: MutableList? = null + private var organizationId: String? = null + private var pageSize: Long? = null + private var pageToken: String? = null + private var projectId: String? = null + private var status: Status? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sheetListParams: SheetListParams) = apply { + configurationId = sheetListParams.configurationId + createdAtOnOrAfter = sheetListParams.createdAtOnOrAfter + createdAtOnOrBefore = sheetListParams.createdAtOnOrBefore + includeResults = sheetListParams.includeResults + jobIds = sheetListParams.jobIds?.toMutableList() + organizationId = sheetListParams.organizationId + pageSize = sheetListParams.pageSize + pageToken = sheetListParams.pageToken + projectId = sheetListParams.projectId + status = sheetListParams.status + additionalHeaders = sheetListParams.additionalHeaders.toBuilder() + additionalQueryParams = sheetListParams.additionalQueryParams.toBuilder() + } + + /** Filter by saved configuration ID */ + fun configurationId(configurationId: String?) = apply { + this.configurationId = configurationId + } + + /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ + fun configurationId(configurationId: Optional) = + configurationId(configurationId.getOrNull()) + + /** Include items created at or after this timestamp (inclusive) */ + fun createdAtOnOrAfter(createdAtOnOrAfter: OffsetDateTime?) = apply { + this.createdAtOnOrAfter = createdAtOnOrAfter + } + + /** + * Alias for calling [Builder.createdAtOnOrAfter] with `createdAtOnOrAfter.orElse(null)`. + */ + fun createdAtOnOrAfter(createdAtOnOrAfter: Optional) = + createdAtOnOrAfter(createdAtOnOrAfter.getOrNull()) + + /** Include items created at or before this timestamp (inclusive) */ + fun createdAtOnOrBefore(createdAtOnOrBefore: OffsetDateTime?) = apply { + this.createdAtOnOrBefore = createdAtOnOrBefore + } + + /** + * Alias for calling [Builder.createdAtOnOrBefore] with `createdAtOnOrBefore.orElse(null)`. + */ + fun createdAtOnOrBefore(createdAtOnOrBefore: Optional) = + createdAtOnOrBefore(createdAtOnOrBefore.getOrNull()) + + fun includeResults(includeResults: Boolean?) = apply { + this.includeResults = includeResults + } + + /** + * Alias for [Builder.includeResults]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) + + /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ + fun includeResults(includeResults: Optional) = + includeResults(includeResults.getOrNull()) + + /** Filter by specific job IDs */ + fun jobIds(jobIds: List?) = apply { this.jobIds = jobIds?.toMutableList() } + + /** Alias for calling [Builder.jobIds] with `jobIds.orElse(null)`. */ + fun jobIds(jobIds: Optional>) = jobIds(jobIds.getOrNull()) + + /** + * Adds a single [String] to [jobIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addJobId(jobId: String) = apply { + jobIds = (jobIds ?: mutableListOf()).apply { add(jobId) } + } + + fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } + + /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ + fun organizationId(organizationId: Optional) = + organizationId(organizationId.getOrNull()) + + fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize } + + /** + * Alias for [Builder.pageSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun pageSize(pageSize: Long) = pageSize(pageSize as Long?) + + /** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */ + fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull()) + + fun pageToken(pageToken: String?) = apply { this.pageToken = pageToken } + + /** Alias for calling [Builder.pageToken] with `pageToken.orElse(null)`. */ + fun pageToken(pageToken: Optional) = pageToken(pageToken.getOrNull()) + + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** Filter by job status */ + fun status(status: Status?) = apply { this.status = status } + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SheetListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SheetListParams = + SheetListParams( + configurationId, + createdAtOnOrAfter, + createdAtOnOrBefore, + includeResults, + jobIds?.toImmutable(), + organizationId, + pageSize, + pageToken, + projectId, + status, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + configurationId?.let { put("configuration_id", it) } + createdAtOnOrAfter?.let { + put("created_at_on_or_after", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + } + createdAtOnOrBefore?.let { + put( + "created_at_on_or_before", + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), + ) + } + includeResults?.let { put("include_results", it.toString()) } + jobIds?.forEach { put("job_ids", it) } + organizationId?.let { put("organization_id", it) } + pageSize?.let { put("page_size", it.toString()) } + pageToken?.let { put("page_token", it) } + projectId?.let { put("project_id", it) } + status?.let { put("status", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** Filter by job status */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PENDING = of("PENDING") + + @JvmField val SUCCESS = of("SUCCESS") + + @JvmField val ERROR = of("ERROR") + + @JvmField val PARTIAL_SUCCESS = of("PARTIAL_SUCCESS") + + @JvmField val CANCELLED = of("CANCELLED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + PENDING, + SUCCESS, + ERROR, + PARTIAL_SUCCESS, + CANCELLED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PENDING, + SUCCESS, + ERROR, + PARTIAL_SUCCESS, + CANCELLED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PENDING -> Value.PENDING + SUCCESS -> Value.SUCCESS + ERROR -> Value.ERROR + PARTIAL_SUCCESS -> Value.PARTIAL_SUCCESS + CANCELLED -> Value.CANCELLED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PENDING -> Known.PENDING + SUCCESS -> Known.SUCCESS + ERROR -> Known.ERROR + PARTIAL_SUCCESS -> Known.PARTIAL_SUCCESS + CANCELLED -> Known.CANCELLED + else -> throw LlamaCloudInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SheetListParams && + configurationId == other.configurationId && + createdAtOnOrAfter == other.createdAtOnOrAfter && + createdAtOnOrBefore == other.createdAtOnOrBefore && + includeResults == other.includeResults && + jobIds == other.jobIds && + organizationId == other.organizationId && + pageSize == other.pageSize && + pageToken == other.pageToken && + projectId == other.projectId && + status == other.status && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + configurationId, + createdAtOnOrAfter, + createdAtOnOrBefore, + includeResults, + jobIds, + organizationId, + pageSize, + pageToken, + projectId, + status, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "SheetListParams{configurationId=$configurationId, createdAtOnOrAfter=$createdAtOnOrAfter, createdAtOnOrBefore=$createdAtOnOrBefore, includeResults=$includeResults, jobIds=$jobIds, organizationId=$organizationId, pageSize=$pageSize, pageToken=$pageToken, projectId=$projectId, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsync.kt index c70569e..75f97a7 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsync.kt @@ -59,16 +59,19 @@ interface PipelineServiceAsync { * A pipeline connects data sources to a vector store for RAG. After creation, call `POST * /pipelines/{id}/sync` to start ingesting documents. */ + @Deprecated("deprecated") fun create(params: PipelineCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: PipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see create */ + @Deprecated("deprecated") fun create( pipelineCreate: PipelineCreate, requestOptions: RequestOptions = RequestOptions.none(), @@ -79,6 +82,7 @@ interface PipelineServiceAsync { ) /** @see create */ + @Deprecated("deprecated") fun create(pipelineCreate: PipelineCreate): CompletableFuture = create(pipelineCreate, RequestOptions.none()) @@ -88,6 +92,7 @@ interface PipelineServiceAsync { * Searches the pipeline's vector store using the provided query and retrieval parameters. * Supports dense, sparse, and hybrid search modes with configurable top-k and reranking. */ + @Deprecated("deprecated") fun retrieve( pipelineId: String, params: PipelineRetrieveParams, @@ -95,6 +100,7 @@ interface PipelineServiceAsync { retrieve(pipelineId, params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( pipelineId: String, params: PipelineRetrieveParams, @@ -103,20 +109,24 @@ interface PipelineServiceAsync { retrieve(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve(params: PipelineRetrieveParams): CompletableFuture = retrieve(params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Update an existing pipeline's configuration. */ + @Deprecated("deprecated") fun update(pipelineId: String): CompletableFuture = update(pipelineId, PipelineUpdateParams.none()) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, params: PipelineUpdateParams = PipelineUpdateParams.none(), @@ -125,40 +135,48 @@ interface PipelineServiceAsync { update(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, params: PipelineUpdateParams = PipelineUpdateParams.none(), ): CompletableFuture = update(pipelineId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: PipelineUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see update */ + @Deprecated("deprecated") fun update(params: PipelineUpdateParams): CompletableFuture = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update(pipelineId: String, requestOptions: RequestOptions): CompletableFuture = update(pipelineId, PipelineUpdateParams.none(), requestOptions) /** Search for pipelines by name, type, or project. */ + @Deprecated("deprecated") fun list(): CompletableFuture> = list(PipelineListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: PipelineListParams = PipelineListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see list */ + @Deprecated("deprecated") fun list( params: PipelineListParams = PipelineListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list(requestOptions: RequestOptions): CompletableFuture> = list(PipelineListParams.none(), requestOptions) @@ -167,10 +185,12 @@ interface PipelineServiceAsync { * * Removes pipeline files, data sources, and vector store data. This operation is irreversible. */ + @Deprecated("deprecated") fun delete(pipelineId: String): CompletableFuture = delete(pipelineId, PipelineDeleteParams.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( pipelineId: String, params: PipelineDeleteParams = PipelineDeleteParams.none(), @@ -179,30 +199,36 @@ interface PipelineServiceAsync { delete(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete( pipelineId: String, params: PipelineDeleteParams = PipelineDeleteParams.none(), ): CompletableFuture = delete(pipelineId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( params: PipelineDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see delete */ + @Deprecated("deprecated") fun delete(params: PipelineDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete(pipelineId: String, requestOptions: RequestOptions): CompletableFuture = delete(pipelineId, PipelineDeleteParams.none(), requestOptions) /** Get a pipeline by ID. */ + @Deprecated("deprecated") fun get(pipelineId: String): CompletableFuture = get(pipelineId, PipelineGetParams.none()) /** @see get */ + @Deprecated("deprecated") fun get( pipelineId: String, params: PipelineGetParams = PipelineGetParams.none(), @@ -211,22 +237,26 @@ interface PipelineServiceAsync { get(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get( pipelineId: String, params: PipelineGetParams = PipelineGetParams.none(), ): CompletableFuture = get(pipelineId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: PipelineGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see get */ + @Deprecated("deprecated") fun get(params: PipelineGetParams): CompletableFuture = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get(pipelineId: String, requestOptions: RequestOptions): CompletableFuture = get(pipelineId, PipelineGetParams.none(), requestOptions) @@ -236,10 +266,12 @@ interface PipelineServiceAsync { * Returns document counts, sync progress, and the last effective timestamp. Only available for * managed pipelines. */ + @Deprecated("deprecated") fun getStatus(pipelineId: String): CompletableFuture = getStatus(pipelineId, PipelineGetStatusParams.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, params: PipelineGetStatusParams = PipelineGetStatusParams.none(), @@ -248,6 +280,7 @@ interface PipelineServiceAsync { getStatus(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, params: PipelineGetStatusParams = PipelineGetStatusParams.none(), @@ -255,17 +288,20 @@ interface PipelineServiceAsync { getStatus(pipelineId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: PipelineGetStatusParams ): CompletableFuture = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, requestOptions: RequestOptions, @@ -278,16 +314,19 @@ interface PipelineServiceAsync { * Updates the pipeline if one with the same name and project already exists, otherwise creates * a new one. */ + @Deprecated("deprecated") fun upsert(params: PipelineUpsertParams): CompletableFuture = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: PipelineUpsertParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see upsert */ + @Deprecated("deprecated") fun upsert( pipelineCreate: PipelineCreate, requestOptions: RequestOptions = RequestOptions.none(), @@ -298,6 +337,7 @@ interface PipelineServiceAsync { ) /** @see upsert */ + @Deprecated("deprecated") fun upsert(pipelineCreate: PipelineCreate): CompletableFuture = upsert(pipelineCreate, RequestOptions.none()) @@ -331,16 +371,19 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `post /api/v1/pipelines`, but is otherwise the same as * [PipelineServiceAsync.create]. */ + @Deprecated("deprecated") fun create(params: PipelineCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: PipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see create */ + @Deprecated("deprecated") fun create( pipelineCreate: PipelineCreate, requestOptions: RequestOptions = RequestOptions.none(), @@ -351,6 +394,7 @@ interface PipelineServiceAsync { ) /** @see create */ + @Deprecated("deprecated") fun create(pipelineCreate: PipelineCreate): CompletableFuture> = create(pipelineCreate, RequestOptions.none()) @@ -358,6 +402,7 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/retrieve`, but is * otherwise the same as [PipelineServiceAsync.retrieve]. */ + @Deprecated("deprecated") fun retrieve( pipelineId: String, params: PipelineRetrieveParams, @@ -365,6 +410,7 @@ interface PipelineServiceAsync { retrieve(pipelineId, params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( pipelineId: String, params: PipelineRetrieveParams, @@ -373,12 +419,14 @@ interface PipelineServiceAsync { retrieve(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( params: PipelineRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -388,10 +436,12 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}`, but is otherwise * the same as [PipelineServiceAsync.update]. */ + @Deprecated("deprecated") fun update(pipelineId: String): CompletableFuture> = update(pipelineId, PipelineUpdateParams.none()) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, params: PipelineUpdateParams = PipelineUpdateParams.none(), @@ -400,6 +450,7 @@ interface PipelineServiceAsync { update(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, params: PipelineUpdateParams = PipelineUpdateParams.none(), @@ -407,16 +458,19 @@ interface PipelineServiceAsync { update(pipelineId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: PipelineUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see update */ + @Deprecated("deprecated") fun update(params: PipelineUpdateParams): CompletableFuture> = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, requestOptions: RequestOptions, @@ -427,21 +481,25 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `get /api/v1/pipelines`, but is otherwise the same as * [PipelineServiceAsync.list]. */ + @Deprecated("deprecated") fun list(): CompletableFuture>> = list(PipelineListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: PipelineListParams = PipelineListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture>> /** @see list */ + @Deprecated("deprecated") fun list( params: PipelineListParams = PipelineListParams.none() ): CompletableFuture>> = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( requestOptions: RequestOptions ): CompletableFuture>> = @@ -451,10 +509,12 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `delete /api/v1/pipelines/{pipeline_id}`, but is * otherwise the same as [PipelineServiceAsync.delete]. */ + @Deprecated("deprecated") fun delete(pipelineId: String): CompletableFuture = delete(pipelineId, PipelineDeleteParams.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( pipelineId: String, params: PipelineDeleteParams = PipelineDeleteParams.none(), @@ -463,22 +523,26 @@ interface PipelineServiceAsync { delete(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete( pipelineId: String, params: PipelineDeleteParams = PipelineDeleteParams.none(), ): CompletableFuture = delete(pipelineId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( params: PipelineDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see delete */ + @Deprecated("deprecated") fun delete(params: PipelineDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( pipelineId: String, requestOptions: RequestOptions, @@ -489,10 +553,12 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `get /api/v1/pipelines/{pipeline_id}`, but is otherwise * the same as [PipelineServiceAsync.get]. */ + @Deprecated("deprecated") fun get(pipelineId: String): CompletableFuture> = get(pipelineId, PipelineGetParams.none()) /** @see get */ + @Deprecated("deprecated") fun get( pipelineId: String, params: PipelineGetParams = PipelineGetParams.none(), @@ -501,6 +567,7 @@ interface PipelineServiceAsync { get(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get( pipelineId: String, params: PipelineGetParams = PipelineGetParams.none(), @@ -508,16 +575,19 @@ interface PipelineServiceAsync { get(pipelineId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: PipelineGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see get */ + @Deprecated("deprecated") fun get(params: PipelineGetParams): CompletableFuture> = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( pipelineId: String, requestOptions: RequestOptions, @@ -528,12 +598,14 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `get /api/v1/pipelines/{pipeline_id}/status`, but is * otherwise the same as [PipelineServiceAsync.getStatus]. */ + @Deprecated("deprecated") fun getStatus( pipelineId: String ): CompletableFuture> = getStatus(pipelineId, PipelineGetStatusParams.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, params: PipelineGetStatusParams = PipelineGetStatusParams.none(), @@ -542,6 +614,7 @@ interface PipelineServiceAsync { getStatus(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, params: PipelineGetStatusParams = PipelineGetStatusParams.none(), @@ -549,18 +622,21 @@ interface PipelineServiceAsync { getStatus(pipelineId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: PipelineGetStatusParams ): CompletableFuture> = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, requestOptions: RequestOptions, @@ -571,16 +647,19 @@ interface PipelineServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines`, but is otherwise the same as * [PipelineServiceAsync.upsert]. */ + @Deprecated("deprecated") fun upsert(params: PipelineUpsertParams): CompletableFuture> = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: PipelineUpsertParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see upsert */ + @Deprecated("deprecated") fun upsert( pipelineCreate: PipelineCreate, requestOptions: RequestOptions = RequestOptions.none(), @@ -591,6 +670,7 @@ interface PipelineServiceAsync { ) /** @see upsert */ + @Deprecated("deprecated") fun upsert(pipelineCreate: PipelineCreate): CompletableFuture> = upsert(pipelineCreate, RequestOptions.none()) } diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsyncImpl.kt index 80c45cd..02824ee 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/PipelineServiceAsyncImpl.kt @@ -82,6 +82,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C override fun documents(): DocumentServiceAsync = documents + @Deprecated("deprecated") override fun create( params: PipelineCreateParams, requestOptions: RequestOptions, @@ -89,6 +90,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // post /api/v1/pipelines withRawResponse().create(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions, @@ -96,6 +98,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // post /api/v1/pipelines/{pipeline_id}/retrieve withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun update( params: PipelineUpdateParams, requestOptions: RequestOptions, @@ -103,6 +106,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // put /api/v1/pipelines/{pipeline_id} withRawResponse().update(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun list( params: PipelineListParams, requestOptions: RequestOptions, @@ -110,6 +114,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines withRawResponse().list(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun delete( params: PipelineDeleteParams, requestOptions: RequestOptions, @@ -117,6 +122,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // delete /api/v1/pipelines/{pipeline_id} withRawResponse().delete(params, requestOptions).thenAccept {} + @Deprecated("deprecated") override fun get( params: PipelineGetParams, requestOptions: RequestOptions, @@ -124,6 +130,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines/{pipeline_id} withRawResponse().get(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions, @@ -131,6 +138,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines/{pipeline_id}/status withRawResponse().getStatus(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun upsert( params: PipelineUpsertParams, requestOptions: RequestOptions, @@ -190,6 +198,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: PipelineCreateParams, requestOptions: RequestOptions, @@ -221,6 +230,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions, @@ -255,6 +265,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun update( params: PipelineUpdateParams, requestOptions: RequestOptions, @@ -289,6 +300,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val listHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun list( params: PipelineListParams, requestOptions: RequestOptions, @@ -318,6 +330,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val deleteHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun delete( params: PipelineDeleteParams, requestOptions: RequestOptions, @@ -345,6 +358,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val getHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun get( params: PipelineGetParams, requestOptions: RequestOptions, @@ -378,6 +392,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions, @@ -411,6 +426,7 @@ class PipelineServiceAsyncImpl internal constructor(private val clientOptions: C private val upsertHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun upsert( params: PipelineUpsertParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsync.kt new file mode 100644 index 0000000..4084953 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsync.kt @@ -0,0 +1,329 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.services.async + +import com.llamacloud_prod.api.core.ClientOptions +import com.llamacloud_prod.api.core.RequestOptions +import com.llamacloud_prod.api.core.http.HttpResponseFor +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.models.files.PresignedUrl +import com.llamacloud_prod.api.models.sheets.SheetCreateParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobResponse +import com.llamacloud_prod.api.models.sheets.SheetGetParams +import com.llamacloud_prod.api.models.sheets.SheetGetResultTableParams +import com.llamacloud_prod.api.models.sheets.SheetListPageAsync +import com.llamacloud_prod.api.models.sheets.SheetListParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface SheetServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SheetServiceAsync + + /** + * Create a spreadsheet parsing job. + * + * Provide at most one of `configuration` (an inline parsing configuration) or + * `configuration_id` (a saved configuration preset). If neither is provided, a default + * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` + * status notifications. + */ + fun create(params: SheetCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: SheetCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** List spreadsheet parsing jobs. */ + fun list(): CompletableFuture = list(SheetListParams.none()) + + /** @see list */ + fun list( + params: SheetListParams = SheetListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list( + params: SheetListParams = SheetListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(SheetListParams.none(), requestOptions) + + /** Delete a spreadsheet parsing job and its associated data. */ + fun deleteJob(spreadsheetJobId: String): CompletableFuture = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + ): CompletableFuture = + deleteJob(spreadsheetJobId, params, RequestOptions.none()) + + /** @see deleteJob */ + fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see deleteJob */ + fun deleteJob(params: SheetDeleteJobParams): CompletableFuture = + deleteJob(params, RequestOptions.none()) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) + + /** + * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted + * regions and results if complete, skipping the separate `/results` call. + */ + fun get(spreadsheetJobId: String): CompletableFuture = + get(spreadsheetJobId, SheetGetParams.none()) + + /** @see get */ + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see get */ + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + ): CompletableFuture = get(spreadsheetJobId, params, RequestOptions.none()) + + /** @see get */ + fun get( + params: SheetGetParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see get */ + fun get(params: SheetGetParams): CompletableFuture = + get(params, RequestOptions.none()) + + /** @see get */ + fun get( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): CompletableFuture = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) + + /** Generate a presigned URL to download a specific extracted region. */ + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + ): CompletableFuture = getResultTable(regionType, params, RequestOptions.none()) + + /** @see getResultTable */ + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) + + /** @see getResultTable */ + fun getResultTable(params: SheetGetResultTableParams): CompletableFuture = + getResultTable(params, RequestOptions.none()) + + /** @see getResultTable */ + fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** A view of [SheetServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SheetServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /api/v1/sheets/jobs`, but is otherwise the same as + * [SheetServiceAsync.create]. + */ + fun create(params: SheetCreateParams): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: SheetCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /api/v1/sheets/jobs`, but is otherwise the same as + * [SheetServiceAsync.list]. + */ + fun list(): CompletableFuture> = + list(SheetListParams.none()) + + /** @see list */ + fun list( + params: SheetListParams = SheetListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: SheetListParams = SheetListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(SheetListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is + * otherwise the same as [SheetServiceAsync.deleteJob]. + */ + fun deleteJob( + spreadsheetJobId: String + ): CompletableFuture> = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + ): CompletableFuture> = + deleteJob(spreadsheetJobId, params, RequestOptions.none()) + + /** @see deleteJob */ + fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see deleteJob */ + fun deleteJob( + params: SheetDeleteJobParams + ): CompletableFuture> = + deleteJob(params, RequestOptions.none()) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is + * otherwise the same as [SheetServiceAsync.get]. + */ + fun get(spreadsheetJobId: String): CompletableFuture> = + get(spreadsheetJobId, SheetGetParams.none()) + + /** @see get */ + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see get */ + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + ): CompletableFuture> = + get(spreadsheetJobId, params, RequestOptions.none()) + + /** @see get */ + fun get( + params: SheetGetParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see get */ + fun get(params: SheetGetParams): CompletableFuture> = + get(params, RequestOptions.none()) + + /** @see get */ + fun get( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + get(spreadsheetJobId, SheetGetParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get + * /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, but + * is otherwise the same as [SheetServiceAsync.getResultTable]. + */ + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + ): CompletableFuture> = + getResultTable(regionType, params, RequestOptions.none()) + + /** @see getResultTable */ + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) + + /** @see getResultTable */ + fun getResultTable( + params: SheetGetResultTableParams + ): CompletableFuture> = + getResultTable(params, RequestOptions.none()) + + /** @see getResultTable */ + fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncImpl.kt new file mode 100644 index 0000000..8f644a8 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncImpl.kt @@ -0,0 +1,272 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.services.async + +import com.llamacloud_prod.api.core.ClientOptions +import com.llamacloud_prod.api.core.RequestOptions +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.core.handlers.errorBodyHandler +import com.llamacloud_prod.api.core.handlers.errorHandler +import com.llamacloud_prod.api.core.handlers.jsonHandler +import com.llamacloud_prod.api.core.http.HttpMethod +import com.llamacloud_prod.api.core.http.HttpRequest +import com.llamacloud_prod.api.core.http.HttpResponse +import com.llamacloud_prod.api.core.http.HttpResponse.Handler +import com.llamacloud_prod.api.core.http.HttpResponseFor +import com.llamacloud_prod.api.core.http.json +import com.llamacloud_prod.api.core.http.parseable +import com.llamacloud_prod.api.core.prepareAsync +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.models.files.PresignedUrl +import com.llamacloud_prod.api.models.sheets.SheetCreateParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobResponse +import com.llamacloud_prod.api.models.sheets.SheetGetParams +import com.llamacloud_prod.api.models.sheets.SheetGetResultTableParams +import com.llamacloud_prod.api.models.sheets.SheetListPageAsync +import com.llamacloud_prod.api.models.sheets.SheetListPageResponse +import com.llamacloud_prod.api.models.sheets.SheetListParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class SheetServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SheetServiceAsync { + + private val withRawResponse: SheetServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): SheetServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SheetServiceAsync = + SheetServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: SheetCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /api/v1/sheets/jobs + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: SheetListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /api/v1/sheets/jobs + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /api/v1/sheets/jobs/{spreadsheet_job_id} + withRawResponse().deleteJob(params, requestOptions).thenApply { it.parse() } + + override fun get( + params: SheetGetParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /api/v1/sheets/jobs/{spreadsheet_job_id} + withRawResponse().get(params, requestOptions).thenApply { it.parse() } + + override fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type} + withRawResponse().getResultTable(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SheetServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): SheetServiceAsync.WithRawResponse = + SheetServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: SheetCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: SheetListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + SheetListPageAsync.builder() + .service(SheetServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) + .params(params) + .response(it) + .build() + } + } + } + } + + private val deleteJobHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { deleteJobHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val getHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun get( + params: SheetGetParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { getHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val getResultTableHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("regionType", params.regionType().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "api", + "v1", + "sheets", + "jobs", + params._pathParam(0), + "regions", + params._pathParam(1), + "result", + params._pathParam(2), + ) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { getResultTableHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsync.kt index f8506de..5699509 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsync.kt @@ -38,44 +38,47 @@ interface SheetServiceAsync { * `configuration_id` (a saved configuration preset). If neither is provided, a default * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` * status notifications. - * - * Experimental: not production-ready and subject to change. */ + @Deprecated("deprecated") fun create(params: SheetCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: SheetCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** List spreadsheet parsing jobs. Experimental: not production-ready and subject to change. */ + /** List spreadsheet parsing jobs. */ + @Deprecated("deprecated") fun list(): CompletableFuture = list(SheetListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: SheetListParams = SheetListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see list */ + @Deprecated("deprecated") fun list( params: SheetListParams = SheetListParams.none() ): CompletableFuture = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list(requestOptions: RequestOptions): CompletableFuture = list(SheetListParams.none(), requestOptions) - /** - * Delete a spreadsheet parsing job and its associated data. Experimental: not production-ready - * and subject to change. - */ + /** Delete a spreadsheet parsing job and its associated data. */ + @Deprecated("deprecated") fun deleteJob(spreadsheetJobId: String): CompletableFuture = deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, params: SheetDeleteJobParams = SheetDeleteJobParams.none(), @@ -84,6 +87,7 @@ interface SheetServiceAsync { deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, params: SheetDeleteJobParams = SheetDeleteJobParams.none(), @@ -91,16 +95,19 @@ interface SheetServiceAsync { deleteJob(spreadsheetJobId, params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob(params: SheetDeleteJobParams): CompletableFuture = deleteJob(params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, requestOptions: RequestOptions, @@ -109,13 +116,14 @@ interface SheetServiceAsync { /** * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted - * regions and results if complete, skipping the separate `/results` call. Experimental: not - * production-ready and subject to change. + * regions and results if complete, skipping the separate `/results` call. */ + @Deprecated("deprecated") fun get(spreadsheetJobId: String): CompletableFuture = get(spreadsheetJobId, SheetGetParams.none()) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none(), @@ -124,37 +132,40 @@ interface SheetServiceAsync { get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none(), ): CompletableFuture = get(spreadsheetJobId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: SheetGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see get */ + @Deprecated("deprecated") fun get(params: SheetGetParams): CompletableFuture = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, requestOptions: RequestOptions, ): CompletableFuture = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - /** - * Generate a presigned URL to download a specific extracted region. Experimental: not - * production-ready and subject to change. - */ + /** Generate a presigned URL to download a specific extracted region. */ + @Deprecated("deprecated") fun getResultTable( regionType: SheetGetResultTableParams.RegionType, params: SheetGetResultTableParams, ): CompletableFuture = getResultTable(regionType, params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( regionType: SheetGetResultTableParams.RegionType, params: SheetGetResultTableParams, @@ -163,10 +174,12 @@ interface SheetServiceAsync { getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable(params: SheetGetResultTableParams): CompletableFuture = getResultTable(params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -188,10 +201,12 @@ interface SheetServiceAsync { * Returns a raw HTTP response for `post /api/v1/beta/sheets/jobs`, but is otherwise the * same as [SheetServiceAsync.create]. */ + @Deprecated("deprecated") fun create(params: SheetCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: SheetCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -201,22 +216,26 @@ interface SheetServiceAsync { * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs`, but is otherwise the same * as [SheetServiceAsync.list]. */ + @Deprecated("deprecated") fun list(): CompletableFuture> = list(SheetListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: SheetListParams = SheetListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see list */ + @Deprecated("deprecated") fun list( params: SheetListParams = SheetListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -226,12 +245,14 @@ interface SheetServiceAsync { * Returns a raw HTTP response for `delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, * but is otherwise the same as [SheetServiceAsync.deleteJob]. */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String ): CompletableFuture> = deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, params: SheetDeleteJobParams = SheetDeleteJobParams.none(), @@ -240,6 +261,7 @@ interface SheetServiceAsync { deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, params: SheetDeleteJobParams = SheetDeleteJobParams.none(), @@ -247,18 +269,21 @@ interface SheetServiceAsync { deleteJob(spreadsheetJobId, params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( params: SheetDeleteJobParams ): CompletableFuture> = deleteJob(params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, requestOptions: RequestOptions, @@ -269,10 +294,12 @@ interface SheetServiceAsync { * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, but * is otherwise the same as [SheetServiceAsync.get]. */ + @Deprecated("deprecated") fun get(spreadsheetJobId: String): CompletableFuture> = get(spreadsheetJobId, SheetGetParams.none()) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none(), @@ -281,6 +308,7 @@ interface SheetServiceAsync { get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none(), @@ -288,16 +316,19 @@ interface SheetServiceAsync { get(spreadsheetJobId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: SheetGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see get */ + @Deprecated("deprecated") fun get(params: SheetGetParams): CompletableFuture> = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, requestOptions: RequestOptions, @@ -309,6 +340,7 @@ interface SheetServiceAsync { * /api/v1/beta/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, * but is otherwise the same as [SheetServiceAsync.getResultTable]. */ + @Deprecated("deprecated") fun getResultTable( regionType: SheetGetResultTableParams.RegionType, params: SheetGetResultTableParams, @@ -316,6 +348,7 @@ interface SheetServiceAsync { getResultTable(regionType, params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( regionType: SheetGetResultTableParams.RegionType, params: SheetGetResultTableParams, @@ -324,12 +357,14 @@ interface SheetServiceAsync { getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( params: SheetGetResultTableParams ): CompletableFuture> = getResultTable(params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsyncImpl.kt index 8671f33..c597529 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/beta/SheetServiceAsyncImpl.kt @@ -42,6 +42,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withOptions(modifier: Consumer): SheetServiceAsync = SheetServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: SheetCreateParams, requestOptions: RequestOptions, @@ -49,6 +50,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie // post /api/v1/beta/sheets/jobs withRawResponse().create(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun list( params: SheetListParams, requestOptions: RequestOptions, @@ -56,6 +58,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie // get /api/v1/beta/sheets/jobs withRawResponse().list(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions, @@ -63,6 +66,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie // delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id} withRawResponse().deleteJob(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun get( params: SheetGetParams, requestOptions: RequestOptions, @@ -70,6 +74,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie // get /api/v1/beta/sheets/jobs/{spreadsheet_job_id} withRawResponse().get(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions, @@ -94,6 +99,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: SheetCreateParams, requestOptions: RequestOptions, @@ -125,6 +131,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun list( params: SheetListParams, requestOptions: RequestOptions, @@ -163,6 +170,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie private val deleteJobHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions, @@ -197,6 +205,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie private val getHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun get( params: SheetGetParams, requestOptions: RequestOptions, @@ -230,6 +239,7 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie private val getResultTableHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsync.kt index 54e25d7..8d62841 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsync.kt @@ -31,12 +31,14 @@ interface DataSourceServiceAsync { fun withOptions(modifier: Consumer): DataSourceServiceAsync /** Update the configuration of a data source in a pipeline. */ + @Deprecated("deprecated") fun update( dataSourceId: String, params: DataSourceUpdateParams, ): CompletableFuture = update(dataSourceId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( dataSourceId: String, params: DataSourceUpdateParams, @@ -45,20 +47,24 @@ interface DataSourceServiceAsync { update(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update(params: DataSourceUpdateParams): CompletableFuture = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get data sources for a pipeline. */ + @Deprecated("deprecated") fun getDataSources(pipelineId: String): CompletableFuture> = getDataSources(pipelineId, DataSourceGetDataSourcesParams.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, params: DataSourceGetDataSourcesParams = DataSourceGetDataSourcesParams.none(), @@ -67,6 +73,7 @@ interface DataSourceServiceAsync { getDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, params: DataSourceGetDataSourcesParams = DataSourceGetDataSourcesParams.none(), @@ -74,17 +81,20 @@ interface DataSourceServiceAsync { getDataSources(pipelineId, params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( params: DataSourceGetDataSourcesParams ): CompletableFuture> = getDataSources(params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, requestOptions: RequestOptions, @@ -92,6 +102,7 @@ interface DataSourceServiceAsync { getDataSources(pipelineId, DataSourceGetDataSourcesParams.none(), requestOptions) /** Get the status of a data source for a pipeline. */ + @Deprecated("deprecated") fun getStatus( dataSourceId: String, params: DataSourceGetStatusParams, @@ -99,6 +110,7 @@ interface DataSourceServiceAsync { getStatus(dataSourceId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( dataSourceId: String, params: DataSourceGetStatusParams, @@ -107,21 +119,25 @@ interface DataSourceServiceAsync { getStatus(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DataSourceGetStatusParams ): CompletableFuture = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Run incremental ingestion: pull upstream changes from the data source into the data sink. */ + @Deprecated("deprecated") fun sync(dataSourceId: String, params: DataSourceSyncParams): CompletableFuture = sync(dataSourceId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( dataSourceId: String, params: DataSourceSyncParams, @@ -130,16 +146,19 @@ interface DataSourceServiceAsync { sync(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") fun sync(params: DataSourceSyncParams): CompletableFuture = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DataSourceSyncParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Add data sources to a pipeline. */ + @Deprecated("deprecated") fun updateDataSources( pipelineId: String, params: DataSourceUpdateDataSourcesParams, @@ -147,6 +166,7 @@ interface DataSourceServiceAsync { updateDataSources(pipelineId, params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( pipelineId: String, params: DataSourceUpdateDataSourcesParams, @@ -155,12 +175,14 @@ interface DataSourceServiceAsync { updateDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( params: DataSourceUpdateDataSourcesParams ): CompletableFuture> = updateDataSources(params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -186,6 +208,7 @@ interface DataSourceServiceAsync { * /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}`, but is otherwise the same * as [DataSourceServiceAsync.update]. */ + @Deprecated("deprecated") fun update( dataSourceId: String, params: DataSourceUpdateParams, @@ -193,6 +216,7 @@ interface DataSourceServiceAsync { update(dataSourceId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( dataSourceId: String, params: DataSourceUpdateParams, @@ -201,12 +225,14 @@ interface DataSourceServiceAsync { update(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update( params: DataSourceUpdateParams ): CompletableFuture> = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -216,12 +242,14 @@ interface DataSourceServiceAsync { * Returns a raw HTTP response for `get /api/v1/pipelines/{pipeline_id}/data-sources`, but * is otherwise the same as [DataSourceServiceAsync.getDataSources]. */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String ): CompletableFuture>> = getDataSources(pipelineId, DataSourceGetDataSourcesParams.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, params: DataSourceGetDataSourcesParams = DataSourceGetDataSourcesParams.none(), @@ -230,6 +258,7 @@ interface DataSourceServiceAsync { getDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, params: DataSourceGetDataSourcesParams = DataSourceGetDataSourcesParams.none(), @@ -237,18 +266,21 @@ interface DataSourceServiceAsync { getDataSources(pipelineId, params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture>> /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( params: DataSourceGetDataSourcesParams ): CompletableFuture>> = getDataSources(params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, requestOptions: RequestOptions, @@ -260,6 +292,7 @@ interface DataSourceServiceAsync { * /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/status`, but is otherwise * the same as [DataSourceServiceAsync.getStatus]. */ + @Deprecated("deprecated") fun getStatus( dataSourceId: String, params: DataSourceGetStatusParams, @@ -267,6 +300,7 @@ interface DataSourceServiceAsync { getStatus(dataSourceId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( dataSourceId: String, params: DataSourceGetStatusParams, @@ -275,12 +309,14 @@ interface DataSourceServiceAsync { getStatus(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DataSourceGetStatusParams ): CompletableFuture> = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -291,6 +327,7 @@ interface DataSourceServiceAsync { * /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/sync`, but is otherwise the * same as [DataSourceServiceAsync.sync]. */ + @Deprecated("deprecated") fun sync( dataSourceId: String, params: DataSourceSyncParams, @@ -298,6 +335,7 @@ interface DataSourceServiceAsync { sync(dataSourceId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( dataSourceId: String, params: DataSourceSyncParams, @@ -306,10 +344,12 @@ interface DataSourceServiceAsync { sync(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") fun sync(params: DataSourceSyncParams): CompletableFuture> = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DataSourceSyncParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -319,6 +359,7 @@ interface DataSourceServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/data-sources`, but * is otherwise the same as [DataSourceServiceAsync.updateDataSources]. */ + @Deprecated("deprecated") fun updateDataSources( pipelineId: String, params: DataSourceUpdateDataSourcesParams, @@ -326,6 +367,7 @@ interface DataSourceServiceAsync { updateDataSources(pipelineId, params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( pipelineId: String, params: DataSourceUpdateDataSourcesParams, @@ -334,12 +376,14 @@ interface DataSourceServiceAsync { updateDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( params: DataSourceUpdateDataSourcesParams ): CompletableFuture>> = updateDataSources(params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsyncImpl.kt index 75d6ada..d1f5d85 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DataSourceServiceAsyncImpl.kt @@ -40,6 +40,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: override fun withOptions(modifier: Consumer): DataSourceServiceAsync = DataSourceServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions, @@ -47,6 +48,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: // put /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id} withRawResponse().update(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions, @@ -54,6 +56,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: // get /api/v1/pipelines/{pipeline_id}/data-sources withRawResponse().getDataSources(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions, @@ -61,6 +64,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: // get /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/status withRawResponse().getStatus(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun sync( params: DataSourceSyncParams, requestOptions: RequestOptions, @@ -68,6 +72,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: // post /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/sync withRawResponse().sync(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions, @@ -91,6 +96,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions, @@ -132,6 +138,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: private val getDataSourcesHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions, @@ -165,6 +172,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions, @@ -205,6 +213,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: private val syncHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun sync( params: DataSourceSyncParams, requestOptions: RequestOptions, @@ -247,6 +256,7 @@ class DataSourceServiceAsyncImpl internal constructor(private val clientOptions: private val updateDataSourcesHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsync.kt index 9d8c263..b464fee 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsync.kt @@ -37,12 +37,14 @@ interface DocumentServiceAsync { fun withOptions(modifier: Consumer): DocumentServiceAsync /** Batch create documents for a pipeline. */ + @Deprecated("deprecated") fun create( pipelineId: String, params: DocumentCreateParams, ): CompletableFuture> = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: DocumentCreateParams, @@ -51,20 +53,24 @@ interface DocumentServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(params: DocumentCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: DocumentCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** Return a list of documents for a pipeline. */ + @Deprecated("deprecated") fun list(pipelineId: String): CompletableFuture = list(pipelineId, DocumentListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, params: DocumentListParams = DocumentListParams.none(), @@ -73,22 +79,26 @@ interface DocumentServiceAsync { list(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, params: DocumentListParams = DocumentListParams.none(), ): CompletableFuture = list(pipelineId, params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: DocumentListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see list */ + @Deprecated("deprecated") fun list(params: DocumentListParams): CompletableFuture = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, requestOptions: RequestOptions, @@ -96,10 +106,12 @@ interface DocumentServiceAsync { list(pipelineId, DocumentListParams.none(), requestOptions) /** Delete a document from a pipeline; runs async (vectors first, then MongoDB record). */ + @Deprecated("deprecated") fun delete(documentId: String, params: DocumentDeleteParams): CompletableFuture = delete(documentId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( documentId: String, params: DocumentDeleteParams, @@ -108,20 +120,24 @@ interface DocumentServiceAsync { delete(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(params: DocumentDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( params: DocumentDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Return a single document for a pipeline. */ + @Deprecated("deprecated") fun get(documentId: String, params: DocumentGetParams): CompletableFuture = get(documentId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( documentId: String, params: DocumentGetParams, @@ -130,22 +146,26 @@ interface DocumentServiceAsync { get(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get(params: DocumentGetParams): CompletableFuture = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: DocumentGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Return a list of chunks for a pipeline document. */ + @Deprecated("deprecated") fun getChunks( documentId: String, params: DocumentGetChunksParams, ): CompletableFuture> = getChunks(documentId, params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( documentId: String, params: DocumentGetChunksParams, @@ -154,16 +174,19 @@ interface DocumentServiceAsync { getChunks(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks(params: DocumentGetChunksParams): CompletableFuture> = getChunks(params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** Return a single document for a pipeline. */ + @Deprecated("deprecated") fun getStatus( documentId: String, params: DocumentGetStatusParams, @@ -171,6 +194,7 @@ interface DocumentServiceAsync { getStatus(documentId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( documentId: String, params: DocumentGetStatusParams, @@ -179,23 +203,27 @@ interface DocumentServiceAsync { getStatus(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DocumentGetStatusParams ): CompletableFuture = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Sync a specific document for a pipeline. */ + @Deprecated("deprecated") fun sync( documentId: String, params: DocumentSyncParams, ): CompletableFuture = sync(documentId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( documentId: String, params: DocumentSyncParams, @@ -204,22 +232,26 @@ interface DocumentServiceAsync { sync(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") fun sync(params: DocumentSyncParams): CompletableFuture = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DocumentSyncParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Batch create or update a document for a pipeline. */ + @Deprecated("deprecated") fun upsert( pipelineId: String, params: DocumentUpsertParams, ): CompletableFuture> = upsert(pipelineId, params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( pipelineId: String, params: DocumentUpsertParams, @@ -228,10 +260,12 @@ interface DocumentServiceAsync { upsert(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see upsert */ + @Deprecated("deprecated") fun upsert(params: DocumentUpsertParams): CompletableFuture> = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -255,6 +289,7 @@ interface DocumentServiceAsync { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/documents`, but is * otherwise the same as [DocumentServiceAsync.create]. */ + @Deprecated("deprecated") fun create( pipelineId: String, params: DocumentCreateParams, @@ -262,6 +297,7 @@ interface DocumentServiceAsync { create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: DocumentCreateParams, @@ -270,12 +306,14 @@ interface DocumentServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create( params: DocumentCreateParams ): CompletableFuture>> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: DocumentCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -286,10 +324,12 @@ interface DocumentServiceAsync { * /api/v1/pipelines/{pipeline_id}/documents/paginated`, but is otherwise the same as * [DocumentServiceAsync.list]. */ + @Deprecated("deprecated") fun list(pipelineId: String): CompletableFuture> = list(pipelineId, DocumentListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, params: DocumentListParams = DocumentListParams.none(), @@ -298,6 +338,7 @@ interface DocumentServiceAsync { list(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, params: DocumentListParams = DocumentListParams.none(), @@ -305,18 +346,21 @@ interface DocumentServiceAsync { list(pipelineId, params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: DocumentListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see list */ + @Deprecated("deprecated") fun list( params: DocumentListParams ): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, requestOptions: RequestOptions, @@ -328,12 +372,14 @@ interface DocumentServiceAsync { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}`, but is otherwise the same as * [DocumentServiceAsync.delete]. */ + @Deprecated("deprecated") fun delete( documentId: String, params: DocumentDeleteParams, ): CompletableFuture = delete(documentId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( documentId: String, params: DocumentDeleteParams, @@ -342,10 +388,12 @@ interface DocumentServiceAsync { delete(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(params: DocumentDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( params: DocumentDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -356,6 +404,7 @@ interface DocumentServiceAsync { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}`, but is otherwise the same as * [DocumentServiceAsync.get]. */ + @Deprecated("deprecated") fun get( documentId: String, params: DocumentGetParams, @@ -363,6 +412,7 @@ interface DocumentServiceAsync { get(documentId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( documentId: String, params: DocumentGetParams, @@ -371,10 +421,12 @@ interface DocumentServiceAsync { get(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get(params: DocumentGetParams): CompletableFuture> = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: DocumentGetParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -385,6 +437,7 @@ interface DocumentServiceAsync { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}/chunks`, but is otherwise the * same as [DocumentServiceAsync.getChunks]. */ + @Deprecated("deprecated") fun getChunks( documentId: String, params: DocumentGetChunksParams, @@ -392,6 +445,7 @@ interface DocumentServiceAsync { getChunks(documentId, params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( documentId: String, params: DocumentGetChunksParams, @@ -400,12 +454,14 @@ interface DocumentServiceAsync { getChunks(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( params: DocumentGetChunksParams ): CompletableFuture>> = getChunks(params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -416,6 +472,7 @@ interface DocumentServiceAsync { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}/status`, but is otherwise the * same as [DocumentServiceAsync.getStatus]. */ + @Deprecated("deprecated") fun getStatus( documentId: String, params: DocumentGetStatusParams, @@ -423,6 +480,7 @@ interface DocumentServiceAsync { getStatus(documentId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( documentId: String, params: DocumentGetStatusParams, @@ -431,12 +489,14 @@ interface DocumentServiceAsync { getStatus(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DocumentGetStatusParams ): CompletableFuture> = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -447,6 +507,7 @@ interface DocumentServiceAsync { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}/sync`, but is otherwise the same * as [DocumentServiceAsync.sync]. */ + @Deprecated("deprecated") fun sync( documentId: String, params: DocumentSyncParams, @@ -454,6 +515,7 @@ interface DocumentServiceAsync { sync(documentId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( documentId: String, params: DocumentSyncParams, @@ -462,12 +524,14 @@ interface DocumentServiceAsync { sync(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DocumentSyncParams ): CompletableFuture> = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DocumentSyncParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -477,6 +541,7 @@ interface DocumentServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/documents`, but is * otherwise the same as [DocumentServiceAsync.upsert]. */ + @Deprecated("deprecated") fun upsert( pipelineId: String, params: DocumentUpsertParams, @@ -484,6 +549,7 @@ interface DocumentServiceAsync { upsert(pipelineId, params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( pipelineId: String, params: DocumentUpsertParams, @@ -492,12 +558,14 @@ interface DocumentServiceAsync { upsert(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: DocumentUpsertParams ): CompletableFuture>> = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsyncImpl.kt index a5db845..430c25a 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/DocumentServiceAsyncImpl.kt @@ -47,6 +47,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C override fun withOptions(modifier: Consumer): DocumentServiceAsync = DocumentServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: DocumentCreateParams, requestOptions: RequestOptions, @@ -54,6 +55,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // post /api/v1/pipelines/{pipeline_id}/documents withRawResponse().create(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun list( params: DocumentListParams, requestOptions: RequestOptions, @@ -61,6 +63,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines/{pipeline_id}/documents/paginated withRawResponse().list(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun delete( params: DocumentDeleteParams, requestOptions: RequestOptions, @@ -68,6 +71,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // delete /api/v1/pipelines/{pipeline_id}/documents/{document_id} withRawResponse().delete(params, requestOptions).thenAccept {} + @Deprecated("deprecated") override fun get( params: DocumentGetParams, requestOptions: RequestOptions, @@ -75,6 +79,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines/{pipeline_id}/documents/{document_id} withRawResponse().get(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions, @@ -82,6 +87,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines/{pipeline_id}/documents/{document_id}/chunks withRawResponse().getChunks(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions, @@ -89,6 +95,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // get /api/v1/pipelines/{pipeline_id}/documents/{document_id}/status withRawResponse().getStatus(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun sync( params: DocumentSyncParams, requestOptions: RequestOptions, @@ -96,6 +103,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C // post /api/v1/pipelines/{pipeline_id}/documents/{document_id}/sync withRawResponse().sync(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions, @@ -119,6 +127,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val createHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: DocumentCreateParams, requestOptions: RequestOptions, @@ -153,6 +162,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun list( params: DocumentListParams, requestOptions: RequestOptions, @@ -200,6 +210,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val deleteHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun delete( params: DocumentDeleteParams, requestOptions: RequestOptions, @@ -235,6 +246,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val getHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun get( params: DocumentGetParams, requestOptions: RequestOptions, @@ -275,6 +287,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val getChunksHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions, @@ -316,6 +329,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions, @@ -357,6 +371,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val syncHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun sync( params: DocumentSyncParams, requestOptions: RequestOptions, @@ -399,6 +414,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C private val upsertHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsync.kt index 1ca7851..4266faf 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsync.kt @@ -34,12 +34,14 @@ interface FileServiceAsync { fun withOptions(modifier: Consumer): FileServiceAsync /** Add files to a pipeline. */ + @Deprecated("deprecated") fun create( pipelineId: String, params: FileCreateParams, ): CompletableFuture> = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: FileCreateParams, @@ -48,20 +50,24 @@ interface FileServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(params: FileCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: FileCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** Update a file for a pipeline. */ + @Deprecated("deprecated") fun update(fileId: String, params: FileUpdateParams): CompletableFuture = update(fileId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( fileId: String, params: FileUpdateParams, @@ -70,10 +76,12 @@ interface FileServiceAsync { update(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update(params: FileUpdateParams): CompletableFuture = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: FileUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -121,10 +129,12 @@ interface FileServiceAsync { list(pipelineId, FileListParams.none(), requestOptions) /** Delete a file from a pipeline. */ + @Deprecated("deprecated") fun delete(fileId: String, params: FileDeleteParams): CompletableFuture = delete(fileId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( fileId: String, params: FileDeleteParams, @@ -132,16 +142,19 @@ interface FileServiceAsync { ): CompletableFuture = delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(params: FileDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( params: FileDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get status of a file for a pipeline. */ + @Deprecated("deprecated") fun getStatus( fileId: String, params: FileGetStatusParams, @@ -149,6 +162,7 @@ interface FileServiceAsync { getStatus(fileId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( fileId: String, params: FileGetStatusParams, @@ -157,20 +171,24 @@ interface FileServiceAsync { getStatus(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus(params: FileGetStatusParams): CompletableFuture = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get files for a pipeline. */ + @Deprecated("deprecated") fun getStatusCounts(pipelineId: String): CompletableFuture = getStatusCounts(pipelineId, FileGetStatusCountsParams.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, params: FileGetStatusCountsParams = FileGetStatusCountsParams.none(), @@ -179,6 +197,7 @@ interface FileServiceAsync { getStatusCounts(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, params: FileGetStatusCountsParams = FileGetStatusCountsParams.none(), @@ -186,18 +205,21 @@ interface FileServiceAsync { getStatusCounts(pipelineId, params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( params: FileGetStatusCountsParams ): CompletableFuture = getStatusCounts(params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, requestOptions: RequestOptions, @@ -218,6 +240,7 @@ interface FileServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/files`, but is * otherwise the same as [FileServiceAsync.create]. */ + @Deprecated("deprecated") fun create( pipelineId: String, params: FileCreateParams, @@ -225,6 +248,7 @@ interface FileServiceAsync { create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: FileCreateParams, @@ -233,12 +257,14 @@ interface FileServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create( params: FileCreateParams ): CompletableFuture>> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: FileCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -248,6 +274,7 @@ interface FileServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/files/{file_id}`, * but is otherwise the same as [FileServiceAsync.update]. */ + @Deprecated("deprecated") fun update( fileId: String, params: FileUpdateParams, @@ -255,6 +282,7 @@ interface FileServiceAsync { update(fileId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( fileId: String, params: FileUpdateParams, @@ -263,10 +291,12 @@ interface FileServiceAsync { update(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update(params: FileUpdateParams): CompletableFuture> = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: FileUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -321,10 +351,12 @@ interface FileServiceAsync { * Returns a raw HTTP response for `delete /api/v1/pipelines/{pipeline_id}/files/{file_id}`, * but is otherwise the same as [FileServiceAsync.delete]. */ + @Deprecated("deprecated") fun delete(fileId: String, params: FileDeleteParams): CompletableFuture = delete(fileId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( fileId: String, params: FileDeleteParams, @@ -333,10 +365,12 @@ interface FileServiceAsync { delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(params: FileDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( params: FileDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -347,6 +381,7 @@ interface FileServiceAsync { * /api/v1/pipelines/{pipeline_id}/files/{file_id}/status`, but is otherwise the same as * [FileServiceAsync.getStatus]. */ + @Deprecated("deprecated") fun getStatus( fileId: String, params: FileGetStatusParams, @@ -354,6 +389,7 @@ interface FileServiceAsync { getStatus(fileId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( fileId: String, params: FileGetStatusParams, @@ -362,12 +398,14 @@ interface FileServiceAsync { getStatus(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: FileGetStatusParams ): CompletableFuture> = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -378,12 +416,14 @@ interface FileServiceAsync { * /api/v1/pipelines/{pipeline_id}/files/status-counts`, but is otherwise the same as * [FileServiceAsync.getStatusCounts]. */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String ): CompletableFuture> = getStatusCounts(pipelineId, FileGetStatusCountsParams.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, params: FileGetStatusCountsParams = FileGetStatusCountsParams.none(), @@ -392,6 +432,7 @@ interface FileServiceAsync { getStatusCounts(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, params: FileGetStatusCountsParams = FileGetStatusCountsParams.none(), @@ -399,18 +440,21 @@ interface FileServiceAsync { getStatusCounts(pipelineId, params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( params: FileGetStatusCountsParams ): CompletableFuture> = getStatusCounts(params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsyncImpl.kt index 35177a7..6c879de 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/FileServiceAsyncImpl.kt @@ -44,6 +44,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withOptions(modifier: Consumer): FileServiceAsync = FileServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: FileCreateParams, requestOptions: RequestOptions, @@ -51,6 +52,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien // put /api/v1/pipelines/{pipeline_id}/files withRawResponse().create(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun update( params: FileUpdateParams, requestOptions: RequestOptions, @@ -66,6 +68,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien // get /api/v1/pipelines/{pipeline_id}/files2 withRawResponse().list(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun delete( params: FileDeleteParams, requestOptions: RequestOptions, @@ -73,6 +76,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien // delete /api/v1/pipelines/{pipeline_id}/files/{file_id} withRawResponse().delete(params, requestOptions).thenAccept {} + @Deprecated("deprecated") override fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions, @@ -80,6 +84,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien // get /api/v1/pipelines/{pipeline_id}/files/{file_id}/status withRawResponse().getStatus(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions, @@ -103,6 +108,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien private val createHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: FileCreateParams, requestOptions: RequestOptions, @@ -137,6 +143,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun update( params: FileUpdateParams, requestOptions: RequestOptions, @@ -219,6 +226,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien private val deleteHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun delete( params: FileDeleteParams, requestOptions: RequestOptions, @@ -254,6 +262,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions, @@ -295,6 +304,7 @@ class FileServiceAsyncImpl internal constructor(private val clientOptions: Clien private val getStatusCountsHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsync.kt index a3d4f5c..df2d349 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsync.kt @@ -27,12 +27,14 @@ interface MetadataServiceAsync { fun withOptions(modifier: Consumer): MetadataServiceAsync /** Import metadata for a pipeline. */ + @Deprecated("deprecated") fun create( pipelineId: String, params: MetadataCreateParams, ): CompletableFuture = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: MetadataCreateParams, @@ -41,20 +43,24 @@ interface MetadataServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(params: MetadataCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: MetadataCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Delete metadata for all files in a pipeline. */ + @Deprecated("deprecated") fun deleteAll(pipelineId: String): CompletableFuture = deleteAll(pipelineId, MetadataDeleteAllParams.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, params: MetadataDeleteAllParams = MetadataDeleteAllParams.none(), @@ -63,22 +69,26 @@ interface MetadataServiceAsync { deleteAll(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, params: MetadataDeleteAllParams = MetadataDeleteAllParams.none(), ): CompletableFuture = deleteAll(pipelineId, params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( params: MetadataDeleteAllParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll(params: MetadataDeleteAllParams): CompletableFuture = deleteAll(params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll(pipelineId: String, requestOptions: RequestOptions): CompletableFuture = deleteAll(pipelineId, MetadataDeleteAllParams.none(), requestOptions) @@ -100,6 +110,7 @@ interface MetadataServiceAsync { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/metadata`, but is * otherwise the same as [MetadataServiceAsync.create]. */ + @Deprecated("deprecated") fun create( pipelineId: String, params: MetadataCreateParams, @@ -107,6 +118,7 @@ interface MetadataServiceAsync { create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: MetadataCreateParams, @@ -115,12 +127,14 @@ interface MetadataServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create( params: MetadataCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: MetadataCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -130,10 +144,12 @@ interface MetadataServiceAsync { * Returns a raw HTTP response for `delete /api/v1/pipelines/{pipeline_id}/metadata`, but is * otherwise the same as [MetadataServiceAsync.deleteAll]. */ + @Deprecated("deprecated") fun deleteAll(pipelineId: String): CompletableFuture = deleteAll(pipelineId, MetadataDeleteAllParams.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, params: MetadataDeleteAllParams = MetadataDeleteAllParams.none(), @@ -142,22 +158,26 @@ interface MetadataServiceAsync { deleteAll(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, params: MetadataDeleteAllParams = MetadataDeleteAllParams.none(), ): CompletableFuture = deleteAll(pipelineId, params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( params: MetadataDeleteAllParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll(params: MetadataDeleteAllParams): CompletableFuture = deleteAll(params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsyncImpl.kt index 94cffc0..3ab4e8d 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/MetadataServiceAsyncImpl.kt @@ -37,6 +37,7 @@ class MetadataServiceAsyncImpl internal constructor(private val clientOptions: C override fun withOptions(modifier: Consumer): MetadataServiceAsync = MetadataServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: MetadataCreateParams, requestOptions: RequestOptions, @@ -44,6 +45,7 @@ class MetadataServiceAsyncImpl internal constructor(private val clientOptions: C // put /api/v1/pipelines/{pipeline_id}/metadata withRawResponse().create(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun deleteAll( params: MetadataDeleteAllParams, requestOptions: RequestOptions, @@ -67,6 +69,7 @@ class MetadataServiceAsyncImpl internal constructor(private val clientOptions: C private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: MetadataCreateParams, requestOptions: RequestOptions, @@ -100,6 +103,7 @@ class MetadataServiceAsyncImpl internal constructor(private val clientOptions: C private val deleteAllHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun deleteAll( params: MetadataDeleteAllParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsync.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsync.kt index c84ce64..f45d3cf 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsync.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsync.kt @@ -31,10 +31,12 @@ interface SyncServiceAsync { * Processes new and updated documents from data sources and files, then updates the index for * retrieval. */ + @Deprecated("deprecated") fun create(pipelineId: String): CompletableFuture = create(pipelineId, SyncCreateParams.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: SyncCreateParams = SyncCreateParams.none(), @@ -43,30 +45,36 @@ interface SyncServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: SyncCreateParams = SyncCreateParams.none(), ): CompletableFuture = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: SyncCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see create */ + @Deprecated("deprecated") fun create(params: SyncCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create(pipelineId: String, requestOptions: RequestOptions): CompletableFuture = create(pipelineId, SyncCreateParams.none(), requestOptions) /** Cancel all running sync jobs for a pipeline. */ + @Deprecated("deprecated") fun cancel(pipelineId: String): CompletableFuture = cancel(pipelineId, SyncCancelParams.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( pipelineId: String, params: SyncCancelParams = SyncCancelParams.none(), @@ -75,22 +83,26 @@ interface SyncServiceAsync { cancel(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see cancel */ + @Deprecated("deprecated") fun cancel( pipelineId: String, params: SyncCancelParams = SyncCancelParams.none(), ): CompletableFuture = cancel(pipelineId, params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( params: SyncCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see cancel */ + @Deprecated("deprecated") fun cancel(params: SyncCancelParams): CompletableFuture = cancel(params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel(pipelineId: String, requestOptions: RequestOptions): CompletableFuture = cancel(pipelineId, SyncCancelParams.none(), requestOptions) @@ -108,10 +120,12 @@ interface SyncServiceAsync { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/sync`, but is * otherwise the same as [SyncServiceAsync.create]. */ + @Deprecated("deprecated") fun create(pipelineId: String): CompletableFuture> = create(pipelineId, SyncCreateParams.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: SyncCreateParams = SyncCreateParams.none(), @@ -120,6 +134,7 @@ interface SyncServiceAsync { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: SyncCreateParams = SyncCreateParams.none(), @@ -127,16 +142,19 @@ interface SyncServiceAsync { create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: SyncCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see create */ + @Deprecated("deprecated") fun create(params: SyncCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, requestOptions: RequestOptions, @@ -147,10 +165,12 @@ interface SyncServiceAsync { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/sync/cancel`, but * is otherwise the same as [SyncServiceAsync.cancel]. */ + @Deprecated("deprecated") fun cancel(pipelineId: String): CompletableFuture> = cancel(pipelineId, SyncCancelParams.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( pipelineId: String, params: SyncCancelParams = SyncCancelParams.none(), @@ -159,6 +179,7 @@ interface SyncServiceAsync { cancel(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see cancel */ + @Deprecated("deprecated") fun cancel( pipelineId: String, params: SyncCancelParams = SyncCancelParams.none(), @@ -166,16 +187,19 @@ interface SyncServiceAsync { cancel(pipelineId, params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( params: SyncCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see cancel */ + @Deprecated("deprecated") fun cancel(params: SyncCancelParams): CompletableFuture> = cancel(params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( pipelineId: String, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsyncImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsyncImpl.kt index a6c8ea7..ad136e0 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsyncImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/async/pipelines/SyncServiceAsyncImpl.kt @@ -35,6 +35,7 @@ class SyncServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withOptions(modifier: Consumer): SyncServiceAsync = SyncServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: SyncCreateParams, requestOptions: RequestOptions, @@ -42,6 +43,7 @@ class SyncServiceAsyncImpl internal constructor(private val clientOptions: Clien // post /api/v1/pipelines/{pipeline_id}/sync withRawResponse().create(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun cancel( params: SyncCancelParams, requestOptions: RequestOptions, @@ -65,6 +67,7 @@ class SyncServiceAsyncImpl internal constructor(private val clientOptions: Clien private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: SyncCreateParams, requestOptions: RequestOptions, @@ -99,6 +102,7 @@ class SyncServiceAsyncImpl internal constructor(private val clientOptions: Clien private val cancelHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun cancel( params: SyncCancelParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineService.kt index 1f67ea4..3a92353 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineService.kt @@ -59,15 +59,18 @@ interface PipelineService { * A pipeline connects data sources to a vector store for RAG. After creation, call `POST * /pipelines/{id}/sync` to start ingesting documents. */ + @Deprecated("deprecated") fun create(params: PipelineCreateParams): Pipeline = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: PipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** @see create */ + @Deprecated("deprecated") fun create( pipelineCreate: PipelineCreate, requestOptions: RequestOptions = RequestOptions.none(), @@ -78,6 +81,7 @@ interface PipelineService { ) /** @see create */ + @Deprecated("deprecated") fun create(pipelineCreate: PipelineCreate): Pipeline = create(pipelineCreate, RequestOptions.none()) @@ -87,10 +91,12 @@ interface PipelineService { * Searches the pipeline's vector store using the provided query and retrieval parameters. * Supports dense, sparse, and hybrid search modes with configurable top-k and reranking. */ + @Deprecated("deprecated") fun retrieve(pipelineId: String, params: PipelineRetrieveParams): PipelineRetrieveResponse = retrieve(pipelineId, params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( pipelineId: String, params: PipelineRetrieveParams, @@ -99,19 +105,23 @@ interface PipelineService { retrieve(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve(params: PipelineRetrieveParams): PipelineRetrieveResponse = retrieve(params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): PipelineRetrieveResponse /** Update an existing pipeline's configuration. */ + @Deprecated("deprecated") fun update(pipelineId: String): Pipeline = update(pipelineId, PipelineUpdateParams.none()) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, params: PipelineUpdateParams = PipelineUpdateParams.none(), @@ -119,38 +129,45 @@ interface PipelineService { ): Pipeline = update(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update( pipelineId: String, params: PipelineUpdateParams = PipelineUpdateParams.none(), ): Pipeline = update(pipelineId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: PipelineUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** @see update */ + @Deprecated("deprecated") fun update(params: PipelineUpdateParams): Pipeline = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update(pipelineId: String, requestOptions: RequestOptions): Pipeline = update(pipelineId, PipelineUpdateParams.none(), requestOptions) /** Search for pipelines by name, type, or project. */ - fun list(): List = list(PipelineListParams.none()) + @Deprecated("deprecated") fun list(): List = list(PipelineListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: PipelineListParams = PipelineListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): List /** @see list */ + @Deprecated("deprecated") fun list(params: PipelineListParams = PipelineListParams.none()): List = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list(requestOptions: RequestOptions): List = list(PipelineListParams.none(), requestOptions) @@ -159,9 +176,11 @@ interface PipelineService { * * Removes pipeline files, data sources, and vector store data. This operation is irreversible. */ + @Deprecated("deprecated") fun delete(pipelineId: String) = delete(pipelineId, PipelineDeleteParams.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( pipelineId: String, params: PipelineDeleteParams = PipelineDeleteParams.none(), @@ -169,23 +188,29 @@ interface PipelineService { ) = delete(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(pipelineId: String, params: PipelineDeleteParams = PipelineDeleteParams.none()) = delete(pipelineId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete(params: PipelineDeleteParams, requestOptions: RequestOptions = RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete(params: PipelineDeleteParams) = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete(pipelineId: String, requestOptions: RequestOptions) = delete(pipelineId, PipelineDeleteParams.none(), requestOptions) /** Get a pipeline by ID. */ + @Deprecated("deprecated") fun get(pipelineId: String): Pipeline = get(pipelineId, PipelineGetParams.none()) /** @see get */ + @Deprecated("deprecated") fun get( pipelineId: String, params: PipelineGetParams = PipelineGetParams.none(), @@ -193,19 +218,23 @@ interface PipelineService { ): Pipeline = get(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get(pipelineId: String, params: PipelineGetParams = PipelineGetParams.none()): Pipeline = get(pipelineId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: PipelineGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** @see get */ + @Deprecated("deprecated") fun get(params: PipelineGetParams): Pipeline = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get(pipelineId: String, requestOptions: RequestOptions): Pipeline = get(pipelineId, PipelineGetParams.none(), requestOptions) @@ -215,10 +244,12 @@ interface PipelineService { * Returns document counts, sync progress, and the last effective timestamp. Only available for * managed pipelines. */ + @Deprecated("deprecated") fun getStatus(pipelineId: String): ManagedIngestionStatusResponse = getStatus(pipelineId, PipelineGetStatusParams.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, params: PipelineGetStatusParams = PipelineGetStatusParams.none(), @@ -227,22 +258,26 @@ interface PipelineService { getStatus(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, params: PipelineGetStatusParams = PipelineGetStatusParams.none(), ): ManagedIngestionStatusResponse = getStatus(pipelineId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): ManagedIngestionStatusResponse /** @see getStatus */ + @Deprecated("deprecated") fun getStatus(params: PipelineGetStatusParams): ManagedIngestionStatusResponse = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( pipelineId: String, requestOptions: RequestOptions, @@ -255,15 +290,18 @@ interface PipelineService { * Updates the pipeline if one with the same name and project already exists, otherwise creates * a new one. */ + @Deprecated("deprecated") fun upsert(params: PipelineUpsertParams): Pipeline = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: PipelineUpsertParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** @see upsert */ + @Deprecated("deprecated") fun upsert( pipelineCreate: PipelineCreate, requestOptions: RequestOptions = RequestOptions.none(), @@ -274,6 +312,7 @@ interface PipelineService { ) /** @see upsert */ + @Deprecated("deprecated") fun upsert(pipelineCreate: PipelineCreate): Pipeline = upsert(pipelineCreate, RequestOptions.none()) @@ -303,11 +342,13 @@ interface PipelineService { * Returns a raw HTTP response for `post /api/v1/pipelines`, but is otherwise the same as * [PipelineService.create]. */ + @Deprecated("deprecated") @MustBeClosed fun create(params: PipelineCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( params: PipelineCreateParams, @@ -315,6 +356,7 @@ interface PipelineService { ): HttpResponseFor /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineCreate: PipelineCreate, @@ -326,6 +368,7 @@ interface PipelineService { ) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create(pipelineCreate: PipelineCreate): HttpResponseFor = create(pipelineCreate, RequestOptions.none()) @@ -334,6 +377,7 @@ interface PipelineService { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/retrieve`, but is * otherwise the same as [PipelineService.retrieve]. */ + @Deprecated("deprecated") @MustBeClosed fun retrieve( pipelineId: String, @@ -342,6 +386,7 @@ interface PipelineService { retrieve(pipelineId, params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") @MustBeClosed fun retrieve( pipelineId: String, @@ -351,11 +396,13 @@ interface PipelineService { retrieve(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see retrieve */ + @Deprecated("deprecated") @MustBeClosed fun retrieve(params: PipelineRetrieveParams): HttpResponseFor = retrieve(params, RequestOptions.none()) /** @see retrieve */ + @Deprecated("deprecated") @MustBeClosed fun retrieve( params: PipelineRetrieveParams, @@ -366,11 +413,13 @@ interface PipelineService { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}`, but is otherwise * the same as [PipelineService.update]. */ + @Deprecated("deprecated") @MustBeClosed fun update(pipelineId: String): HttpResponseFor = update(pipelineId, PipelineUpdateParams.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( pipelineId: String, @@ -380,6 +429,7 @@ interface PipelineService { update(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( pipelineId: String, @@ -387,6 +437,7 @@ interface PipelineService { ): HttpResponseFor = update(pipelineId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( params: PipelineUpdateParams, @@ -394,11 +445,13 @@ interface PipelineService { ): HttpResponseFor /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update(params: PipelineUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update(pipelineId: String, requestOptions: RequestOptions): HttpResponseFor = update(pipelineId, PipelineUpdateParams.none(), requestOptions) @@ -407,9 +460,12 @@ interface PipelineService { * Returns a raw HTTP response for `get /api/v1/pipelines`, but is otherwise the same as * [PipelineService.list]. */ - @MustBeClosed fun list(): HttpResponseFor> = list(PipelineListParams.none()) + @Deprecated("deprecated") + @MustBeClosed + fun list(): HttpResponseFor> = list(PipelineListParams.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( params: PipelineListParams = PipelineListParams.none(), @@ -417,12 +473,14 @@ interface PipelineService { ): HttpResponseFor> /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( params: PipelineListParams = PipelineListParams.none() ): HttpResponseFor> = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor> = list(PipelineListParams.none(), requestOptions) @@ -431,11 +489,13 @@ interface PipelineService { * Returns a raw HTTP response for `delete /api/v1/pipelines/{pipeline_id}`, but is * otherwise the same as [PipelineService.delete]. */ + @Deprecated("deprecated") @MustBeClosed fun delete(pipelineId: String): HttpResponse = delete(pipelineId, PipelineDeleteParams.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( pipelineId: String, @@ -444,6 +504,7 @@ interface PipelineService { ): HttpResponse = delete(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( pipelineId: String, @@ -451,6 +512,7 @@ interface PipelineService { ): HttpResponse = delete(pipelineId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( params: PipelineDeleteParams, @@ -458,11 +520,13 @@ interface PipelineService { ): HttpResponse /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete(params: PipelineDeleteParams): HttpResponse = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete(pipelineId: String, requestOptions: RequestOptions): HttpResponse = delete(pipelineId, PipelineDeleteParams.none(), requestOptions) @@ -471,11 +535,13 @@ interface PipelineService { * Returns a raw HTTP response for `get /api/v1/pipelines/{pipeline_id}`, but is otherwise * the same as [PipelineService.get]. */ + @Deprecated("deprecated") @MustBeClosed fun get(pipelineId: String): HttpResponseFor = get(pipelineId, PipelineGetParams.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( pipelineId: String, @@ -485,6 +551,7 @@ interface PipelineService { get(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( pipelineId: String, @@ -492,6 +559,7 @@ interface PipelineService { ): HttpResponseFor = get(pipelineId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( params: PipelineGetParams, @@ -499,11 +567,13 @@ interface PipelineService { ): HttpResponseFor /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get(params: PipelineGetParams): HttpResponseFor = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get(pipelineId: String, requestOptions: RequestOptions): HttpResponseFor = get(pipelineId, PipelineGetParams.none(), requestOptions) @@ -512,11 +582,13 @@ interface PipelineService { * Returns a raw HTTP response for `get /api/v1/pipelines/{pipeline_id}/status`, but is * otherwise the same as [PipelineService.getStatus]. */ + @Deprecated("deprecated") @MustBeClosed fun getStatus(pipelineId: String): HttpResponseFor = getStatus(pipelineId, PipelineGetStatusParams.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( pipelineId: String, @@ -526,6 +598,7 @@ interface PipelineService { getStatus(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( pipelineId: String, @@ -534,6 +607,7 @@ interface PipelineService { getStatus(pipelineId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: PipelineGetStatusParams, @@ -541,6 +615,7 @@ interface PipelineService { ): HttpResponseFor /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: PipelineGetStatusParams @@ -548,6 +623,7 @@ interface PipelineService { getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( pipelineId: String, @@ -559,11 +635,13 @@ interface PipelineService { * Returns a raw HTTP response for `put /api/v1/pipelines`, but is otherwise the same as * [PipelineService.upsert]. */ + @Deprecated("deprecated") @MustBeClosed fun upsert(params: PipelineUpsertParams): HttpResponseFor = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") @MustBeClosed fun upsert( params: PipelineUpsertParams, @@ -571,6 +649,7 @@ interface PipelineService { ): HttpResponseFor /** @see upsert */ + @Deprecated("deprecated") @MustBeClosed fun upsert( pipelineCreate: PipelineCreate, @@ -582,6 +661,7 @@ interface PipelineService { ) /** @see upsert */ + @Deprecated("deprecated") @MustBeClosed fun upsert(pipelineCreate: PipelineCreate): HttpResponseFor = upsert(pipelineCreate, RequestOptions.none()) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineServiceImpl.kt index 698ae5e..d2b20d0 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/PipelineServiceImpl.kt @@ -79,10 +79,12 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client override fun documents(): DocumentService = documents + @Deprecated("deprecated") override fun create(params: PipelineCreateParams, requestOptions: RequestOptions): Pipeline = // post /api/v1/pipelines withRawResponse().create(params, requestOptions).parse() + @Deprecated("deprecated") override fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions, @@ -90,23 +92,28 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client // post /api/v1/pipelines/{pipeline_id}/retrieve withRawResponse().retrieve(params, requestOptions).parse() + @Deprecated("deprecated") override fun update(params: PipelineUpdateParams, requestOptions: RequestOptions): Pipeline = // put /api/v1/pipelines/{pipeline_id} withRawResponse().update(params, requestOptions).parse() + @Deprecated("deprecated") override fun list(params: PipelineListParams, requestOptions: RequestOptions): List = // get /api/v1/pipelines withRawResponse().list(params, requestOptions).parse() + @Deprecated("deprecated") override fun delete(params: PipelineDeleteParams, requestOptions: RequestOptions) { // delete /api/v1/pipelines/{pipeline_id} withRawResponse().delete(params, requestOptions) } + @Deprecated("deprecated") override fun get(params: PipelineGetParams, requestOptions: RequestOptions): Pipeline = // get /api/v1/pipelines/{pipeline_id} withRawResponse().get(params, requestOptions).parse() + @Deprecated("deprecated") override fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions, @@ -114,6 +121,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client // get /api/v1/pipelines/{pipeline_id}/status withRawResponse().getStatus(params, requestOptions).parse() + @Deprecated("deprecated") override fun upsert(params: PipelineUpsertParams, requestOptions: RequestOptions): Pipeline = // put /api/v1/pipelines withRawResponse().upsert(params, requestOptions).parse() @@ -170,6 +178,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: PipelineCreateParams, requestOptions: RequestOptions, @@ -198,6 +207,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun retrieve( params: PipelineRetrieveParams, requestOptions: RequestOptions, @@ -229,6 +239,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun update( params: PipelineUpdateParams, requestOptions: RequestOptions, @@ -260,6 +271,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val listHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun list( params: PipelineListParams, requestOptions: RequestOptions, @@ -286,6 +298,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val deleteHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun delete( params: PipelineDeleteParams, requestOptions: RequestOptions, @@ -310,6 +323,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val getHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun get( params: PipelineGetParams, requestOptions: RequestOptions, @@ -340,6 +354,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: PipelineGetStatusParams, requestOptions: RequestOptions, @@ -370,6 +385,7 @@ class PipelineServiceImpl internal constructor(private val clientOptions: Client private val upsertHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun upsert( params: PipelineUpsertParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetService.kt new file mode 100644 index 0000000..484cf15 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetService.kt @@ -0,0 +1,325 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.llamacloud_prod.api.core.ClientOptions +import com.llamacloud_prod.api.core.RequestOptions +import com.llamacloud_prod.api.core.http.HttpResponseFor +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.models.files.PresignedUrl +import com.llamacloud_prod.api.models.sheets.SheetCreateParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobResponse +import com.llamacloud_prod.api.models.sheets.SheetGetParams +import com.llamacloud_prod.api.models.sheets.SheetGetResultTableParams +import com.llamacloud_prod.api.models.sheets.SheetListPage +import com.llamacloud_prod.api.models.sheets.SheetListParams +import java.util.function.Consumer + +interface SheetService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SheetService + + /** + * Create a spreadsheet parsing job. + * + * Provide at most one of `configuration` (an inline parsing configuration) or + * `configuration_id` (a saved configuration preset). If neither is provided, a default + * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` + * status notifications. + */ + fun create(params: SheetCreateParams): SheetsJob = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: SheetCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SheetsJob + + /** List spreadsheet parsing jobs. */ + fun list(): SheetListPage = list(SheetListParams.none()) + + /** @see list */ + fun list( + params: SheetListParams = SheetListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SheetListPage + + /** @see list */ + fun list(params: SheetListParams = SheetListParams.none()): SheetListPage = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): SheetListPage = + list(SheetListParams.none(), requestOptions) + + /** Delete a spreadsheet parsing job and its associated data. */ + fun deleteJob(spreadsheetJobId: String): SheetDeleteJobResponse = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SheetDeleteJobResponse = + deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + ): SheetDeleteJobResponse = deleteJob(spreadsheetJobId, params, RequestOptions.none()) + + /** @see deleteJob */ + fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SheetDeleteJobResponse + + /** @see deleteJob */ + fun deleteJob(params: SheetDeleteJobParams): SheetDeleteJobResponse = + deleteJob(params, RequestOptions.none()) + + /** @see deleteJob */ + fun deleteJob( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): SheetDeleteJobResponse = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) + + /** + * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted + * regions and results if complete, skipping the separate `/results` call. + */ + fun get(spreadsheetJobId: String): SheetsJob = get(spreadsheetJobId, SheetGetParams.none()) + + /** @see get */ + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SheetsJob = + get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see get */ + fun get(spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none()): SheetsJob = + get(spreadsheetJobId, params, RequestOptions.none()) + + /** @see get */ + fun get( + params: SheetGetParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SheetsJob + + /** @see get */ + fun get(params: SheetGetParams): SheetsJob = get(params, RequestOptions.none()) + + /** @see get */ + fun get(spreadsheetJobId: String, requestOptions: RequestOptions): SheetsJob = + get(spreadsheetJobId, SheetGetParams.none(), requestOptions) + + /** Generate a presigned URL to download a specific extracted region. */ + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + ): PresignedUrl = getResultTable(regionType, params, RequestOptions.none()) + + /** @see getResultTable */ + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): PresignedUrl = + getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) + + /** @see getResultTable */ + fun getResultTable(params: SheetGetResultTableParams): PresignedUrl = + getResultTable(params, RequestOptions.none()) + + /** @see getResultTable */ + fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): PresignedUrl + + /** A view of [SheetService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SheetService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /api/v1/sheets/jobs`, but is otherwise the same as + * [SheetService.create]. + */ + @MustBeClosed + fun create(params: SheetCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: SheetCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /api/v1/sheets/jobs`, but is otherwise the same as + * [SheetService.list]. + */ + @MustBeClosed fun list(): HttpResponseFor = list(SheetListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: SheetListParams = SheetListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: SheetListParams = SheetListParams.none()): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(SheetListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is + * otherwise the same as [SheetService.deleteJob]. + */ + @MustBeClosed + fun deleteJob(spreadsheetJobId: String): HttpResponseFor = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) + + /** @see deleteJob */ + @MustBeClosed + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see deleteJob */ + @MustBeClosed + fun deleteJob( + spreadsheetJobId: String, + params: SheetDeleteJobParams = SheetDeleteJobParams.none(), + ): HttpResponseFor = + deleteJob(spreadsheetJobId, params, RequestOptions.none()) + + /** @see deleteJob */ + @MustBeClosed + fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see deleteJob */ + @MustBeClosed + fun deleteJob(params: SheetDeleteJobParams): HttpResponseFor = + deleteJob(params, RequestOptions.none()) + + /** @see deleteJob */ + @MustBeClosed + fun deleteJob( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is + * otherwise the same as [SheetService.get]. + */ + @MustBeClosed + fun get(spreadsheetJobId: String): HttpResponseFor = + get(spreadsheetJobId, SheetGetParams.none()) + + /** @see get */ + @MustBeClosed + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) + + /** @see get */ + @MustBeClosed + fun get( + spreadsheetJobId: String, + params: SheetGetParams = SheetGetParams.none(), + ): HttpResponseFor = get(spreadsheetJobId, params, RequestOptions.none()) + + /** @see get */ + @MustBeClosed + fun get( + params: SheetGetParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see get */ + @MustBeClosed + fun get(params: SheetGetParams): HttpResponseFor = + get(params, RequestOptions.none()) + + /** @see get */ + @MustBeClosed + fun get( + spreadsheetJobId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get + * /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, but + * is otherwise the same as [SheetService.getResultTable]. + */ + @MustBeClosed + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + ): HttpResponseFor = getResultTable(regionType, params, RequestOptions.none()) + + /** @see getResultTable */ + @MustBeClosed + fun getResultTable( + regionType: SheetGetResultTableParams.RegionType, + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) + + /** @see getResultTable */ + @MustBeClosed + fun getResultTable(params: SheetGetResultTableParams): HttpResponseFor = + getResultTable(params, RequestOptions.none()) + + /** @see getResultTable */ + @MustBeClosed + fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceImpl.kt new file mode 100644 index 0000000..7404f18 --- /dev/null +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceImpl.kt @@ -0,0 +1,246 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.services.blocking + +import com.llamacloud_prod.api.core.ClientOptions +import com.llamacloud_prod.api.core.RequestOptions +import com.llamacloud_prod.api.core.checkRequired +import com.llamacloud_prod.api.core.handlers.errorBodyHandler +import com.llamacloud_prod.api.core.handlers.errorHandler +import com.llamacloud_prod.api.core.handlers.jsonHandler +import com.llamacloud_prod.api.core.http.HttpMethod +import com.llamacloud_prod.api.core.http.HttpRequest +import com.llamacloud_prod.api.core.http.HttpResponse +import com.llamacloud_prod.api.core.http.HttpResponse.Handler +import com.llamacloud_prod.api.core.http.HttpResponseFor +import com.llamacloud_prod.api.core.http.json +import com.llamacloud_prod.api.core.http.parseable +import com.llamacloud_prod.api.core.prepare +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.models.files.PresignedUrl +import com.llamacloud_prod.api.models.sheets.SheetCreateParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobResponse +import com.llamacloud_prod.api.models.sheets.SheetGetParams +import com.llamacloud_prod.api.models.sheets.SheetGetResultTableParams +import com.llamacloud_prod.api.models.sheets.SheetListPage +import com.llamacloud_prod.api.models.sheets.SheetListPageResponse +import com.llamacloud_prod.api.models.sheets.SheetListParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class SheetServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SheetService { + + private val withRawResponse: SheetService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): SheetService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SheetService = + SheetServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create(params: SheetCreateParams, requestOptions: RequestOptions): SheetsJob = + // post /api/v1/sheets/jobs + withRawResponse().create(params, requestOptions).parse() + + override fun list(params: SheetListParams, requestOptions: RequestOptions): SheetListPage = + // get /api/v1/sheets/jobs + withRawResponse().list(params, requestOptions).parse() + + override fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions, + ): SheetDeleteJobResponse = + // delete /api/v1/sheets/jobs/{spreadsheet_job_id} + withRawResponse().deleteJob(params, requestOptions).parse() + + override fun get(params: SheetGetParams, requestOptions: RequestOptions): SheetsJob = + // get /api/v1/sheets/jobs/{spreadsheet_job_id} + withRawResponse().get(params, requestOptions).parse() + + override fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions, + ): PresignedUrl = + // get /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type} + withRawResponse().getResultTable(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SheetService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): SheetService.WithRawResponse = + SheetServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: SheetCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: SheetListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + SheetListPage.builder() + .service(SheetServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() + } + } + } + + private val deleteJobHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun deleteJob( + params: SheetDeleteJobParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { deleteJobHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val getHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun get( + params: SheetGetParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { getHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val getResultTableHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun getResultTable( + params: SheetGetResultTableParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("regionType", params.regionType().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "api", + "v1", + "sheets", + "jobs", + params._pathParam(0), + "regions", + params._pathParam(1), + "result", + params._pathParam(2), + ) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { getResultTableHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetService.kt index f76c7f4..ae5d3c7 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetService.kt @@ -38,42 +38,44 @@ interface SheetService { * `configuration_id` (a saved configuration preset). If neither is provided, a default * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` * status notifications. - * - * Experimental: not production-ready and subject to change. */ + @Deprecated("deprecated") fun create(params: SheetCreateParams): SheetsJob = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: SheetCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): SheetsJob - /** List spreadsheet parsing jobs. Experimental: not production-ready and subject to change. */ - fun list(): SheetListPage = list(SheetListParams.none()) + /** List spreadsheet parsing jobs. */ + @Deprecated("deprecated") fun list(): SheetListPage = list(SheetListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: SheetListParams = SheetListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): SheetListPage /** @see list */ + @Deprecated("deprecated") fun list(params: SheetListParams = SheetListParams.none()): SheetListPage = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list(requestOptions: RequestOptions): SheetListPage = list(SheetListParams.none(), requestOptions) - /** - * Delete a spreadsheet parsing job and its associated data. Experimental: not production-ready - * and subject to change. - */ + /** Delete a spreadsheet parsing job and its associated data. */ + @Deprecated("deprecated") fun deleteJob(spreadsheetJobId: String): SheetDeleteJobResponse = deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, params: SheetDeleteJobParams = SheetDeleteJobParams.none(), @@ -82,22 +84,26 @@ interface SheetService { deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, params: SheetDeleteJobParams = SheetDeleteJobParams.none(), ): SheetDeleteJobResponse = deleteJob(spreadsheetJobId, params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions = RequestOptions.none(), ): SheetDeleteJobResponse /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob(params: SheetDeleteJobParams): SheetDeleteJobResponse = deleteJob(params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") fun deleteJob( spreadsheetJobId: String, requestOptions: RequestOptions, @@ -106,12 +112,13 @@ interface SheetService { /** * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted - * regions and results if complete, skipping the separate `/results` call. Experimental: not - * production-ready and subject to change. + * regions and results if complete, skipping the separate `/results` call. */ + @Deprecated("deprecated") fun get(spreadsheetJobId: String): SheetsJob = get(spreadsheetJobId, SheetGetParams.none()) /** @see get */ + @Deprecated("deprecated") fun get( spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none(), @@ -120,32 +127,35 @@ interface SheetService { get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get(spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none()): SheetsJob = get(spreadsheetJobId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: SheetGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): SheetsJob /** @see get */ + @Deprecated("deprecated") fun get(params: SheetGetParams): SheetsJob = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get(spreadsheetJobId: String, requestOptions: RequestOptions): SheetsJob = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - /** - * Generate a presigned URL to download a specific extracted region. Experimental: not - * production-ready and subject to change. - */ + /** Generate a presigned URL to download a specific extracted region. */ + @Deprecated("deprecated") fun getResultTable( regionType: SheetGetResultTableParams.RegionType, params: SheetGetResultTableParams, ): PresignedUrl = getResultTable(regionType, params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( regionType: SheetGetResultTableParams.RegionType, params: SheetGetResultTableParams, @@ -154,10 +164,12 @@ interface SheetService { getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable(params: SheetGetResultTableParams): PresignedUrl = getResultTable(params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -177,11 +189,13 @@ interface SheetService { * Returns a raw HTTP response for `post /api/v1/beta/sheets/jobs`, but is otherwise the * same as [SheetService.create]. */ + @Deprecated("deprecated") @MustBeClosed fun create(params: SheetCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( params: SheetCreateParams, @@ -192,9 +206,12 @@ interface SheetService { * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs`, but is otherwise the same * as [SheetService.list]. */ - @MustBeClosed fun list(): HttpResponseFor = list(SheetListParams.none()) + @Deprecated("deprecated") + @MustBeClosed + fun list(): HttpResponseFor = list(SheetListParams.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( params: SheetListParams = SheetListParams.none(), @@ -202,11 +219,13 @@ interface SheetService { ): HttpResponseFor /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list(params: SheetListParams = SheetListParams.none()): HttpResponseFor = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(SheetListParams.none(), requestOptions) @@ -215,11 +234,13 @@ interface SheetService { * Returns a raw HTTP response for `delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, * but is otherwise the same as [SheetService.deleteJob]. */ + @Deprecated("deprecated") @MustBeClosed fun deleteJob(spreadsheetJobId: String): HttpResponseFor = deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) /** @see deleteJob */ + @Deprecated("deprecated") @MustBeClosed fun deleteJob( spreadsheetJobId: String, @@ -229,6 +250,7 @@ interface SheetService { deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see deleteJob */ + @Deprecated("deprecated") @MustBeClosed fun deleteJob( spreadsheetJobId: String, @@ -237,6 +259,7 @@ interface SheetService { deleteJob(spreadsheetJobId, params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") @MustBeClosed fun deleteJob( params: SheetDeleteJobParams, @@ -244,11 +267,13 @@ interface SheetService { ): HttpResponseFor /** @see deleteJob */ + @Deprecated("deprecated") @MustBeClosed fun deleteJob(params: SheetDeleteJobParams): HttpResponseFor = deleteJob(params, RequestOptions.none()) /** @see deleteJob */ + @Deprecated("deprecated") @MustBeClosed fun deleteJob( spreadsheetJobId: String, @@ -260,11 +285,13 @@ interface SheetService { * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, but * is otherwise the same as [SheetService.get]. */ + @Deprecated("deprecated") @MustBeClosed fun get(spreadsheetJobId: String): HttpResponseFor = get(spreadsheetJobId, SheetGetParams.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( spreadsheetJobId: String, @@ -274,6 +301,7 @@ interface SheetService { get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( spreadsheetJobId: String, @@ -281,6 +309,7 @@ interface SheetService { ): HttpResponseFor = get(spreadsheetJobId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( params: SheetGetParams, @@ -288,11 +317,13 @@ interface SheetService { ): HttpResponseFor /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get(params: SheetGetParams): HttpResponseFor = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( spreadsheetJobId: String, @@ -304,6 +335,7 @@ interface SheetService { * /api/v1/beta/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, * but is otherwise the same as [SheetService.getResultTable]. */ + @Deprecated("deprecated") @MustBeClosed fun getResultTable( regionType: SheetGetResultTableParams.RegionType, @@ -311,6 +343,7 @@ interface SheetService { ): HttpResponseFor = getResultTable(regionType, params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") @MustBeClosed fun getResultTable( regionType: SheetGetResultTableParams.RegionType, @@ -320,11 +353,13 @@ interface SheetService { getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) /** @see getResultTable */ + @Deprecated("deprecated") @MustBeClosed fun getResultTable(params: SheetGetResultTableParams): HttpResponseFor = getResultTable(params, RequestOptions.none()) /** @see getResultTable */ + @Deprecated("deprecated") @MustBeClosed fun getResultTable( params: SheetGetResultTableParams, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetServiceImpl.kt index a50eb82..7a6da52 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/beta/SheetServiceImpl.kt @@ -41,14 +41,17 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withOptions(modifier: Consumer): SheetService = SheetServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create(params: SheetCreateParams, requestOptions: RequestOptions): SheetsJob = // post /api/v1/beta/sheets/jobs withRawResponse().create(params, requestOptions).parse() + @Deprecated("deprecated") override fun list(params: SheetListParams, requestOptions: RequestOptions): SheetListPage = // get /api/v1/beta/sheets/jobs withRawResponse().list(params, requestOptions).parse() + @Deprecated("deprecated") override fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions, @@ -56,10 +59,12 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt // delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id} withRawResponse().deleteJob(params, requestOptions).parse() + @Deprecated("deprecated") override fun get(params: SheetGetParams, requestOptions: RequestOptions): SheetsJob = // get /api/v1/beta/sheets/jobs/{spreadsheet_job_id} withRawResponse().get(params, requestOptions).parse() + @Deprecated("deprecated") override fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions, @@ -84,6 +89,7 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: SheetCreateParams, requestOptions: RequestOptions, @@ -112,6 +118,7 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun list( params: SheetListParams, requestOptions: RequestOptions, @@ -146,6 +153,7 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt private val deleteJobHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun deleteJob( params: SheetDeleteJobParams, requestOptions: RequestOptions, @@ -177,6 +185,7 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt private val getHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun get( params: SheetGetParams, requestOptions: RequestOptions, @@ -207,6 +216,7 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt private val getResultTableHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getResultTable( params: SheetGetResultTableParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceService.kt index 2593e84..a4a3910 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceService.kt @@ -31,10 +31,12 @@ interface DataSourceService { fun withOptions(modifier: Consumer): DataSourceService /** Update the configuration of a data source in a pipeline. */ + @Deprecated("deprecated") fun update(dataSourceId: String, params: DataSourceUpdateParams): PipelineDataSource = update(dataSourceId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( dataSourceId: String, params: DataSourceUpdateParams, @@ -43,20 +45,24 @@ interface DataSourceService { update(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update(params: DataSourceUpdateParams): PipelineDataSource = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): PipelineDataSource /** Get data sources for a pipeline. */ + @Deprecated("deprecated") fun getDataSources(pipelineId: String): List = getDataSources(pipelineId, DataSourceGetDataSourcesParams.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, params: DataSourceGetDataSourcesParams = DataSourceGetDataSourcesParams.none(), @@ -65,22 +71,26 @@ interface DataSourceService { getDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, params: DataSourceGetDataSourcesParams = DataSourceGetDataSourcesParams.none(), ): List = getDataSources(pipelineId, params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions = RequestOptions.none(), ): List /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources(params: DataSourceGetDataSourcesParams): List = getDataSources(params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") fun getDataSources( pipelineId: String, requestOptions: RequestOptions, @@ -88,12 +98,14 @@ interface DataSourceService { getDataSources(pipelineId, DataSourceGetDataSourcesParams.none(), requestOptions) /** Get the status of a data source for a pipeline. */ + @Deprecated("deprecated") fun getStatus( dataSourceId: String, params: DataSourceGetStatusParams, ): ManagedIngestionStatusResponse = getStatus(dataSourceId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( dataSourceId: String, params: DataSourceGetStatusParams, @@ -102,20 +114,24 @@ interface DataSourceService { getStatus(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus(params: DataSourceGetStatusParams): ManagedIngestionStatusResponse = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): ManagedIngestionStatusResponse /** Run incremental ingestion: pull upstream changes from the data source into the data sink. */ + @Deprecated("deprecated") fun sync(dataSourceId: String, params: DataSourceSyncParams): Pipeline = sync(dataSourceId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( dataSourceId: String, params: DataSourceSyncParams, @@ -123,21 +139,25 @@ interface DataSourceService { ): Pipeline = sync(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") fun sync(params: DataSourceSyncParams): Pipeline = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DataSourceSyncParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** Add data sources to a pipeline. */ + @Deprecated("deprecated") fun updateDataSources( pipelineId: String, params: DataSourceUpdateDataSourcesParams, ): List = updateDataSources(pipelineId, params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( pipelineId: String, params: DataSourceUpdateDataSourcesParams, @@ -146,10 +166,12 @@ interface DataSourceService { updateDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources(params: DataSourceUpdateDataSourcesParams): List = updateDataSources(params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -172,6 +194,7 @@ interface DataSourceService { * /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}`, but is otherwise the same * as [DataSourceService.update]. */ + @Deprecated("deprecated") @MustBeClosed fun update( dataSourceId: String, @@ -179,6 +202,7 @@ interface DataSourceService { ): HttpResponseFor = update(dataSourceId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( dataSourceId: String, @@ -188,11 +212,13 @@ interface DataSourceService { update(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update(params: DataSourceUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( params: DataSourceUpdateParams, @@ -203,11 +229,13 @@ interface DataSourceService { * Returns a raw HTTP response for `get /api/v1/pipelines/{pipeline_id}/data-sources`, but * is otherwise the same as [DataSourceService.getDataSources]. */ + @Deprecated("deprecated") @MustBeClosed fun getDataSources(pipelineId: String): HttpResponseFor> = getDataSources(pipelineId, DataSourceGetDataSourcesParams.none()) /** @see getDataSources */ + @Deprecated("deprecated") @MustBeClosed fun getDataSources( pipelineId: String, @@ -217,6 +245,7 @@ interface DataSourceService { getDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getDataSources */ + @Deprecated("deprecated") @MustBeClosed fun getDataSources( pipelineId: String, @@ -225,6 +254,7 @@ interface DataSourceService { getDataSources(pipelineId, params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") @MustBeClosed fun getDataSources( params: DataSourceGetDataSourcesParams, @@ -232,12 +262,14 @@ interface DataSourceService { ): HttpResponseFor> /** @see getDataSources */ + @Deprecated("deprecated") @MustBeClosed fun getDataSources( params: DataSourceGetDataSourcesParams ): HttpResponseFor> = getDataSources(params, RequestOptions.none()) /** @see getDataSources */ + @Deprecated("deprecated") @MustBeClosed fun getDataSources( pipelineId: String, @@ -250,6 +282,7 @@ interface DataSourceService { * /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/status`, but is otherwise * the same as [DataSourceService.getStatus]. */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( dataSourceId: String, @@ -258,6 +291,7 @@ interface DataSourceService { getStatus(dataSourceId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( dataSourceId: String, @@ -267,6 +301,7 @@ interface DataSourceService { getStatus(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: DataSourceGetStatusParams @@ -274,6 +309,7 @@ interface DataSourceService { getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: DataSourceGetStatusParams, @@ -285,11 +321,13 @@ interface DataSourceService { * /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/sync`, but is otherwise the * same as [DataSourceService.sync]. */ + @Deprecated("deprecated") @MustBeClosed fun sync(dataSourceId: String, params: DataSourceSyncParams): HttpResponseFor = sync(dataSourceId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") @MustBeClosed fun sync( dataSourceId: String, @@ -299,11 +337,13 @@ interface DataSourceService { sync(params.toBuilder().dataSourceId(dataSourceId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") @MustBeClosed fun sync(params: DataSourceSyncParams): HttpResponseFor = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") @MustBeClosed fun sync( params: DataSourceSyncParams, @@ -314,6 +354,7 @@ interface DataSourceService { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/data-sources`, but * is otherwise the same as [DataSourceService.updateDataSources]. */ + @Deprecated("deprecated") @MustBeClosed fun updateDataSources( pipelineId: String, @@ -322,6 +363,7 @@ interface DataSourceService { updateDataSources(pipelineId, params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") @MustBeClosed fun updateDataSources( pipelineId: String, @@ -331,6 +373,7 @@ interface DataSourceService { updateDataSources(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see updateDataSources */ + @Deprecated("deprecated") @MustBeClosed fun updateDataSources( params: DataSourceUpdateDataSourcesParams @@ -338,6 +381,7 @@ interface DataSourceService { updateDataSources(params, RequestOptions.none()) /** @see updateDataSources */ + @Deprecated("deprecated") @MustBeClosed fun updateDataSources( params: DataSourceUpdateDataSourcesParams, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceServiceImpl.kt index d85fdc4..2663d09 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DataSourceServiceImpl.kt @@ -39,6 +39,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie override fun withOptions(modifier: Consumer): DataSourceService = DataSourceServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions, @@ -46,6 +47,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie // put /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id} withRawResponse().update(params, requestOptions).parse() + @Deprecated("deprecated") override fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions, @@ -53,6 +55,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie // get /api/v1/pipelines/{pipeline_id}/data-sources withRawResponse().getDataSources(params, requestOptions).parse() + @Deprecated("deprecated") override fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions, @@ -60,10 +63,12 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie // get /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/status withRawResponse().getStatus(params, requestOptions).parse() + @Deprecated("deprecated") override fun sync(params: DataSourceSyncParams, requestOptions: RequestOptions): Pipeline = // post /api/v1/pipelines/{pipeline_id}/data-sources/{data_source_id}/sync withRawResponse().sync(params, requestOptions).parse() + @Deprecated("deprecated") override fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions, @@ -87,6 +92,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun update( params: DataSourceUpdateParams, requestOptions: RequestOptions, @@ -125,6 +131,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie private val getDataSourcesHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getDataSources( params: DataSourceGetDataSourcesParams, requestOptions: RequestOptions, @@ -155,6 +162,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: DataSourceGetStatusParams, requestOptions: RequestOptions, @@ -192,6 +200,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie private val syncHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun sync( params: DataSourceSyncParams, requestOptions: RequestOptions, @@ -231,6 +240,7 @@ class DataSourceServiceImpl internal constructor(private val clientOptions: Clie private val updateDataSourcesHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun updateDataSources( params: DataSourceUpdateDataSourcesParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentService.kt index 584ec23..ecf2349 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentService.kt @@ -37,10 +37,12 @@ interface DocumentService { fun withOptions(modifier: Consumer): DocumentService /** Batch create documents for a pipeline. */ + @Deprecated("deprecated") fun create(pipelineId: String, params: DocumentCreateParams): List = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: DocumentCreateParams, @@ -49,19 +51,23 @@ interface DocumentService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(params: DocumentCreateParams): List = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: DocumentCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): List /** Return a list of documents for a pipeline. */ + @Deprecated("deprecated") fun list(pipelineId: String): DocumentListPage = list(pipelineId, DocumentListParams.none()) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, params: DocumentListParams = DocumentListParams.none(), @@ -69,29 +75,35 @@ interface DocumentService { ): DocumentListPage = list(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see list */ + @Deprecated("deprecated") fun list( pipelineId: String, params: DocumentListParams = DocumentListParams.none(), ): DocumentListPage = list(pipelineId, params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list( params: DocumentListParams, requestOptions: RequestOptions = RequestOptions.none(), ): DocumentListPage /** @see list */ + @Deprecated("deprecated") fun list(params: DocumentListParams): DocumentListPage = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") fun list(pipelineId: String, requestOptions: RequestOptions): DocumentListPage = list(pipelineId, DocumentListParams.none(), requestOptions) /** Delete a document from a pipeline; runs async (vectors first, then MongoDB record). */ + @Deprecated("deprecated") fun delete(documentId: String, params: DocumentDeleteParams) = delete(documentId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( documentId: String, params: DocumentDeleteParams, @@ -99,16 +111,20 @@ interface DocumentService { ) = delete(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(params: DocumentDeleteParams) = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete(params: DocumentDeleteParams, requestOptions: RequestOptions = RequestOptions.none()) /** Return a single document for a pipeline. */ + @Deprecated("deprecated") fun get(documentId: String, params: DocumentGetParams): CloudDocument = get(documentId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( documentId: String, params: DocumentGetParams, @@ -116,19 +132,23 @@ interface DocumentService { ): CloudDocument = get(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") fun get(params: DocumentGetParams): CloudDocument = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") fun get( params: DocumentGetParams, requestOptions: RequestOptions = RequestOptions.none(), ): CloudDocument /** Return a list of chunks for a pipeline document. */ + @Deprecated("deprecated") fun getChunks(documentId: String, params: DocumentGetChunksParams): List = getChunks(documentId, params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( documentId: String, params: DocumentGetChunksParams, @@ -136,22 +156,26 @@ interface DocumentService { ): List = getChunks(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks(params: DocumentGetChunksParams): List = getChunks(params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions = RequestOptions.none(), ): List /** Return a single document for a pipeline. */ + @Deprecated("deprecated") fun getStatus( documentId: String, params: DocumentGetStatusParams, ): ManagedIngestionStatusResponse = getStatus(documentId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( documentId: String, params: DocumentGetStatusParams, @@ -160,20 +184,24 @@ interface DocumentService { getStatus(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus(params: DocumentGetStatusParams): ManagedIngestionStatusResponse = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): ManagedIngestionStatusResponse /** Sync a specific document for a pipeline. */ + @Deprecated("deprecated") fun sync(documentId: String, params: DocumentSyncParams): DocumentSyncResponse = sync(documentId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( documentId: String, params: DocumentSyncParams, @@ -182,19 +210,23 @@ interface DocumentService { sync(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") fun sync(params: DocumentSyncParams): DocumentSyncResponse = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") fun sync( params: DocumentSyncParams, requestOptions: RequestOptions = RequestOptions.none(), ): DocumentSyncResponse /** Batch create or update a document for a pipeline. */ + @Deprecated("deprecated") fun upsert(pipelineId: String, params: DocumentUpsertParams): List = upsert(pipelineId, params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( pipelineId: String, params: DocumentUpsertParams, @@ -203,10 +235,12 @@ interface DocumentService { upsert(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see upsert */ + @Deprecated("deprecated") fun upsert(params: DocumentUpsertParams): List = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -226,6 +260,7 @@ interface DocumentService { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/documents`, but is * otherwise the same as [DocumentService.create]. */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -233,6 +268,7 @@ interface DocumentService { ): HttpResponseFor> = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -242,11 +278,13 @@ interface DocumentService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create(params: DocumentCreateParams): HttpResponseFor> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( params: DocumentCreateParams, @@ -258,11 +296,13 @@ interface DocumentService { * /api/v1/pipelines/{pipeline_id}/documents/paginated`, but is otherwise the same as * [DocumentService.list]. */ + @Deprecated("deprecated") @MustBeClosed fun list(pipelineId: String): HttpResponseFor = list(pipelineId, DocumentListParams.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( pipelineId: String, @@ -272,6 +312,7 @@ interface DocumentService { list(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( pipelineId: String, @@ -279,6 +320,7 @@ interface DocumentService { ): HttpResponseFor = list(pipelineId, params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( params: DocumentListParams, @@ -286,11 +328,13 @@ interface DocumentService { ): HttpResponseFor /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list(params: DocumentListParams): HttpResponseFor = list(params, RequestOptions.none()) /** @see list */ + @Deprecated("deprecated") @MustBeClosed fun list( pipelineId: String, @@ -303,11 +347,13 @@ interface DocumentService { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}`, but is otherwise the same as * [DocumentService.delete]. */ + @Deprecated("deprecated") @MustBeClosed fun delete(documentId: String, params: DocumentDeleteParams): HttpResponse = delete(documentId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( documentId: String, @@ -316,11 +362,13 @@ interface DocumentService { ): HttpResponse = delete(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete(params: DocumentDeleteParams): HttpResponse = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( params: DocumentDeleteParams, @@ -332,11 +380,13 @@ interface DocumentService { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}`, but is otherwise the same as * [DocumentService.get]. */ + @Deprecated("deprecated") @MustBeClosed fun get(documentId: String, params: DocumentGetParams): HttpResponseFor = get(documentId, params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( documentId: String, @@ -346,11 +396,13 @@ interface DocumentService { get(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get(params: DocumentGetParams): HttpResponseFor = get(params, RequestOptions.none()) /** @see get */ + @Deprecated("deprecated") @MustBeClosed fun get( params: DocumentGetParams, @@ -362,6 +414,7 @@ interface DocumentService { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}/chunks`, but is otherwise the * same as [DocumentService.getChunks]. */ + @Deprecated("deprecated") @MustBeClosed fun getChunks( documentId: String, @@ -369,6 +422,7 @@ interface DocumentService { ): HttpResponseFor> = getChunks(documentId, params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") @MustBeClosed fun getChunks( documentId: String, @@ -378,11 +432,13 @@ interface DocumentService { getChunks(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getChunks */ + @Deprecated("deprecated") @MustBeClosed fun getChunks(params: DocumentGetChunksParams): HttpResponseFor> = getChunks(params, RequestOptions.none()) /** @see getChunks */ + @Deprecated("deprecated") @MustBeClosed fun getChunks( params: DocumentGetChunksParams, @@ -394,6 +450,7 @@ interface DocumentService { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}/status`, but is otherwise the * same as [DocumentService.getStatus]. */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( documentId: String, @@ -402,6 +459,7 @@ interface DocumentService { getStatus(documentId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( documentId: String, @@ -411,6 +469,7 @@ interface DocumentService { getStatus(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: DocumentGetStatusParams @@ -418,6 +477,7 @@ interface DocumentService { getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: DocumentGetStatusParams, @@ -429,6 +489,7 @@ interface DocumentService { * /api/v1/pipelines/{pipeline_id}/documents/{document_id}/sync`, but is otherwise the same * as [DocumentService.sync]. */ + @Deprecated("deprecated") @MustBeClosed fun sync( documentId: String, @@ -436,6 +497,7 @@ interface DocumentService { ): HttpResponseFor = sync(documentId, params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") @MustBeClosed fun sync( documentId: String, @@ -445,11 +507,13 @@ interface DocumentService { sync(params.toBuilder().documentId(documentId).build(), requestOptions) /** @see sync */ + @Deprecated("deprecated") @MustBeClosed fun sync(params: DocumentSyncParams): HttpResponseFor = sync(params, RequestOptions.none()) /** @see sync */ + @Deprecated("deprecated") @MustBeClosed fun sync( params: DocumentSyncParams, @@ -460,6 +524,7 @@ interface DocumentService { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/documents`, but is * otherwise the same as [DocumentService.upsert]. */ + @Deprecated("deprecated") @MustBeClosed fun upsert( pipelineId: String, @@ -467,6 +532,7 @@ interface DocumentService { ): HttpResponseFor> = upsert(pipelineId, params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") @MustBeClosed fun upsert( pipelineId: String, @@ -476,11 +542,13 @@ interface DocumentService { upsert(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see upsert */ + @Deprecated("deprecated") @MustBeClosed fun upsert(params: DocumentUpsertParams): HttpResponseFor> = upsert(params, RequestOptions.none()) /** @see upsert */ + @Deprecated("deprecated") @MustBeClosed fun upsert( params: DocumentUpsertParams, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentServiceImpl.kt index d6b0026..b10705f 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/DocumentServiceImpl.kt @@ -46,6 +46,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client override fun withOptions(modifier: Consumer): DocumentService = DocumentServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: DocumentCreateParams, requestOptions: RequestOptions, @@ -53,6 +54,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client // post /api/v1/pipelines/{pipeline_id}/documents withRawResponse().create(params, requestOptions).parse() + @Deprecated("deprecated") override fun list( params: DocumentListParams, requestOptions: RequestOptions, @@ -60,15 +62,18 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client // get /api/v1/pipelines/{pipeline_id}/documents/paginated withRawResponse().list(params, requestOptions).parse() + @Deprecated("deprecated") override fun delete(params: DocumentDeleteParams, requestOptions: RequestOptions) { // delete /api/v1/pipelines/{pipeline_id}/documents/{document_id} withRawResponse().delete(params, requestOptions) } + @Deprecated("deprecated") override fun get(params: DocumentGetParams, requestOptions: RequestOptions): CloudDocument = // get /api/v1/pipelines/{pipeline_id}/documents/{document_id} withRawResponse().get(params, requestOptions).parse() + @Deprecated("deprecated") override fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions, @@ -76,6 +81,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client // get /api/v1/pipelines/{pipeline_id}/documents/{document_id}/chunks withRawResponse().getChunks(params, requestOptions).parse() + @Deprecated("deprecated") override fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions, @@ -83,6 +89,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client // get /api/v1/pipelines/{pipeline_id}/documents/{document_id}/status withRawResponse().getStatus(params, requestOptions).parse() + @Deprecated("deprecated") override fun sync( params: DocumentSyncParams, requestOptions: RequestOptions, @@ -90,6 +97,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client // post /api/v1/pipelines/{pipeline_id}/documents/{document_id}/sync withRawResponse().sync(params, requestOptions).parse() + @Deprecated("deprecated") override fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions, @@ -113,6 +121,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val createHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: DocumentCreateParams, requestOptions: RequestOptions, @@ -144,6 +153,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun list( params: DocumentListParams, requestOptions: RequestOptions, @@ -187,6 +197,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val deleteHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun delete( params: DocumentDeleteParams, requestOptions: RequestOptions, @@ -219,6 +230,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val getHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun get( params: DocumentGetParams, requestOptions: RequestOptions, @@ -256,6 +268,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val getChunksHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getChunks( params: DocumentGetChunksParams, requestOptions: RequestOptions, @@ -294,6 +307,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: DocumentGetStatusParams, requestOptions: RequestOptions, @@ -332,6 +346,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val syncHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun sync( params: DocumentSyncParams, requestOptions: RequestOptions, @@ -371,6 +386,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client private val upsertHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun upsert( params: DocumentUpsertParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileService.kt index 458f39c..5da0658 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileService.kt @@ -34,10 +34,12 @@ interface FileService { fun withOptions(modifier: Consumer): FileService /** Add files to a pipeline. */ + @Deprecated("deprecated") fun create(pipelineId: String, params: FileCreateParams): List = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: FileCreateParams, @@ -46,19 +48,23 @@ interface FileService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(params: FileCreateParams): List = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: FileCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): List /** Update a file for a pipeline. */ + @Deprecated("deprecated") fun update(fileId: String, params: FileUpdateParams): PipelineFile = update(fileId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( fileId: String, params: FileUpdateParams, @@ -66,9 +72,11 @@ interface FileService { ): PipelineFile = update(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") fun update(params: FileUpdateParams): PipelineFile = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") fun update( params: FileUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -108,10 +116,12 @@ interface FileService { list(pipelineId, FileListParams.none(), requestOptions) /** Delete a file from a pipeline. */ + @Deprecated("deprecated") fun delete(fileId: String, params: FileDeleteParams) = delete(fileId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete( fileId: String, params: FileDeleteParams, @@ -119,16 +129,20 @@ interface FileService { ) = delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") fun delete(params: FileDeleteParams) = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") fun delete(params: FileDeleteParams, requestOptions: RequestOptions = RequestOptions.none()) /** Get status of a file for a pipeline. */ + @Deprecated("deprecated") fun getStatus(fileId: String, params: FileGetStatusParams): ManagedIngestionStatusResponse = getStatus(fileId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( fileId: String, params: FileGetStatusParams, @@ -137,20 +151,24 @@ interface FileService { getStatus(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus(params: FileGetStatusParams): ManagedIngestionStatusResponse = getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions = RequestOptions.none(), ): ManagedIngestionStatusResponse /** Get files for a pipeline. */ + @Deprecated("deprecated") fun getStatusCounts(pipelineId: String): FileGetStatusCountsResponse = getStatusCounts(pipelineId, FileGetStatusCountsParams.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, params: FileGetStatusCountsParams = FileGetStatusCountsParams.none(), @@ -159,22 +177,26 @@ interface FileService { getStatusCounts(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, params: FileGetStatusCountsParams = FileGetStatusCountsParams.none(), ): FileGetStatusCountsResponse = getStatusCounts(pipelineId, params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions = RequestOptions.none(), ): FileGetStatusCountsResponse /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts(params: FileGetStatusCountsParams): FileGetStatusCountsResponse = getStatusCounts(params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") fun getStatusCounts( pipelineId: String, requestOptions: RequestOptions, @@ -195,6 +217,7 @@ interface FileService { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/files`, but is * otherwise the same as [FileService.create]. */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -202,6 +225,7 @@ interface FileService { ): HttpResponseFor> = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -211,11 +235,13 @@ interface FileService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create(params: FileCreateParams): HttpResponseFor> = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( params: FileCreateParams, @@ -226,11 +252,13 @@ interface FileService { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/files/{file_id}`, * but is otherwise the same as [FileService.update]. */ + @Deprecated("deprecated") @MustBeClosed fun update(fileId: String, params: FileUpdateParams): HttpResponseFor = update(fileId, params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( fileId: String, @@ -240,11 +268,13 @@ interface FileService { update(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update(params: FileUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) /** @see update */ + @Deprecated("deprecated") @MustBeClosed fun update( params: FileUpdateParams, @@ -304,11 +334,13 @@ interface FileService { * Returns a raw HTTP response for `delete /api/v1/pipelines/{pipeline_id}/files/{file_id}`, * but is otherwise the same as [FileService.delete]. */ + @Deprecated("deprecated") @MustBeClosed fun delete(fileId: String, params: FileDeleteParams): HttpResponse = delete(fileId, params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( fileId: String, @@ -317,10 +349,12 @@ interface FileService { ): HttpResponse = delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete(params: FileDeleteParams): HttpResponse = delete(params, RequestOptions.none()) /** @see delete */ + @Deprecated("deprecated") @MustBeClosed fun delete( params: FileDeleteParams, @@ -332,6 +366,7 @@ interface FileService { * /api/v1/pipelines/{pipeline_id}/files/{file_id}/status`, but is otherwise the same as * [FileService.getStatus]. */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( fileId: String, @@ -340,6 +375,7 @@ interface FileService { getStatus(fileId, params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( fileId: String, @@ -349,6 +385,7 @@ interface FileService { getStatus(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: FileGetStatusParams @@ -356,6 +393,7 @@ interface FileService { getStatus(params, RequestOptions.none()) /** @see getStatus */ + @Deprecated("deprecated") @MustBeClosed fun getStatus( params: FileGetStatusParams, @@ -367,11 +405,13 @@ interface FileService { * /api/v1/pipelines/{pipeline_id}/files/status-counts`, but is otherwise the same as * [FileService.getStatusCounts]. */ + @Deprecated("deprecated") @MustBeClosed fun getStatusCounts(pipelineId: String): HttpResponseFor = getStatusCounts(pipelineId, FileGetStatusCountsParams.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") @MustBeClosed fun getStatusCounts( pipelineId: String, @@ -381,6 +421,7 @@ interface FileService { getStatusCounts(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see getStatusCounts */ + @Deprecated("deprecated") @MustBeClosed fun getStatusCounts( pipelineId: String, @@ -389,6 +430,7 @@ interface FileService { getStatusCounts(pipelineId, params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") @MustBeClosed fun getStatusCounts( params: FileGetStatusCountsParams, @@ -396,6 +438,7 @@ interface FileService { ): HttpResponseFor /** @see getStatusCounts */ + @Deprecated("deprecated") @MustBeClosed fun getStatusCounts( params: FileGetStatusCountsParams @@ -403,6 +446,7 @@ interface FileService { getStatusCounts(params, RequestOptions.none()) /** @see getStatusCounts */ + @Deprecated("deprecated") @MustBeClosed fun getStatusCounts( pipelineId: String, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileServiceImpl.kt index 1229629..8ad7fb8 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/FileServiceImpl.kt @@ -42,6 +42,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withOptions(modifier: Consumer): FileService = FileServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: FileCreateParams, requestOptions: RequestOptions, @@ -49,6 +50,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti // put /api/v1/pipelines/{pipeline_id}/files withRawResponse().create(params, requestOptions).parse() + @Deprecated("deprecated") override fun update(params: FileUpdateParams, requestOptions: RequestOptions): PipelineFile = // put /api/v1/pipelines/{pipeline_id}/files/{file_id} withRawResponse().update(params, requestOptions).parse() @@ -58,11 +60,13 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti // get /api/v1/pipelines/{pipeline_id}/files2 withRawResponse().list(params, requestOptions).parse() + @Deprecated("deprecated") override fun delete(params: FileDeleteParams, requestOptions: RequestOptions) { // delete /api/v1/pipelines/{pipeline_id}/files/{file_id} withRawResponse().delete(params, requestOptions) } + @Deprecated("deprecated") override fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions, @@ -70,6 +74,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti // get /api/v1/pipelines/{pipeline_id}/files/{file_id}/status withRawResponse().getStatus(params, requestOptions).parse() + @Deprecated("deprecated") override fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions, @@ -93,6 +98,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti private val createHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: FileCreateParams, requestOptions: RequestOptions, @@ -124,6 +130,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun update( params: FileUpdateParams, requestOptions: RequestOptions, @@ -199,6 +206,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti private val deleteHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun delete( params: FileDeleteParams, requestOptions: RequestOptions, @@ -231,6 +239,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti private val getStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatus( params: FileGetStatusParams, requestOptions: RequestOptions, @@ -269,6 +278,7 @@ class FileServiceImpl internal constructor(private val clientOptions: ClientOpti private val getStatusCountsHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun getStatusCounts( params: FileGetStatusCountsParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataService.kt index 6be0bcf..f877b53 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataService.kt @@ -27,10 +27,12 @@ interface MetadataService { fun withOptions(modifier: Consumer): MetadataService /** Import metadata for a pipeline. */ + @Deprecated("deprecated") fun create(pipelineId: String, params: MetadataCreateParams): MetadataCreateResponse = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: MetadataCreateParams, @@ -39,19 +41,23 @@ interface MetadataService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(params: MetadataCreateParams): MetadataCreateResponse = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: MetadataCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): MetadataCreateResponse /** Delete metadata for all files in a pipeline. */ + @Deprecated("deprecated") fun deleteAll(pipelineId: String) = deleteAll(pipelineId, MetadataDeleteAllParams.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, params: MetadataDeleteAllParams = MetadataDeleteAllParams.none(), @@ -59,21 +65,25 @@ interface MetadataService { ) = deleteAll(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( pipelineId: String, params: MetadataDeleteAllParams = MetadataDeleteAllParams.none(), ) = deleteAll(pipelineId, params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll( params: MetadataDeleteAllParams, requestOptions: RequestOptions = RequestOptions.none(), ) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll(params: MetadataDeleteAllParams) = deleteAll(params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") fun deleteAll(pipelineId: String, requestOptions: RequestOptions) = deleteAll(pipelineId, MetadataDeleteAllParams.none(), requestOptions) @@ -91,6 +101,7 @@ interface MetadataService { * Returns a raw HTTP response for `put /api/v1/pipelines/{pipeline_id}/metadata`, but is * otherwise the same as [MetadataService.create]. */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -99,6 +110,7 @@ interface MetadataService { create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -108,11 +120,13 @@ interface MetadataService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create(params: MetadataCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( params: MetadataCreateParams, @@ -123,11 +137,13 @@ interface MetadataService { * Returns a raw HTTP response for `delete /api/v1/pipelines/{pipeline_id}/metadata`, but is * otherwise the same as [MetadataService.deleteAll]. */ + @Deprecated("deprecated") @MustBeClosed fun deleteAll(pipelineId: String): HttpResponse = deleteAll(pipelineId, MetadataDeleteAllParams.none()) /** @see deleteAll */ + @Deprecated("deprecated") @MustBeClosed fun deleteAll( pipelineId: String, @@ -137,6 +153,7 @@ interface MetadataService { deleteAll(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see deleteAll */ + @Deprecated("deprecated") @MustBeClosed fun deleteAll( pipelineId: String, @@ -144,6 +161,7 @@ interface MetadataService { ): HttpResponse = deleteAll(pipelineId, params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") @MustBeClosed fun deleteAll( params: MetadataDeleteAllParams, @@ -151,11 +169,13 @@ interface MetadataService { ): HttpResponse /** @see deleteAll */ + @Deprecated("deprecated") @MustBeClosed fun deleteAll(params: MetadataDeleteAllParams): HttpResponse = deleteAll(params, RequestOptions.none()) /** @see deleteAll */ + @Deprecated("deprecated") @MustBeClosed fun deleteAll(pipelineId: String, requestOptions: RequestOptions): HttpResponse = deleteAll(pipelineId, MetadataDeleteAllParams.none(), requestOptions) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataServiceImpl.kt index c82e295..c99359d 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/MetadataServiceImpl.kt @@ -36,6 +36,7 @@ class MetadataServiceImpl internal constructor(private val clientOptions: Client override fun withOptions(modifier: Consumer): MetadataService = MetadataServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create( params: MetadataCreateParams, requestOptions: RequestOptions, @@ -43,6 +44,7 @@ class MetadataServiceImpl internal constructor(private val clientOptions: Client // put /api/v1/pipelines/{pipeline_id}/metadata withRawResponse().create(params, requestOptions).parse() + @Deprecated("deprecated") override fun deleteAll(params: MetadataDeleteAllParams, requestOptions: RequestOptions) { // delete /api/v1/pipelines/{pipeline_id}/metadata withRawResponse().deleteAll(params, requestOptions) @@ -64,6 +66,7 @@ class MetadataServiceImpl internal constructor(private val clientOptions: Client private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: MetadataCreateParams, requestOptions: RequestOptions, @@ -94,6 +97,7 @@ class MetadataServiceImpl internal constructor(private val clientOptions: Client private val deleteAllHandler: Handler = emptyHandler() + @Deprecated("deprecated") override fun deleteAll( params: MetadataDeleteAllParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncService.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncService.kt index 9696a02..9dc356e 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncService.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncService.kt @@ -31,9 +31,11 @@ interface SyncService { * Processes new and updated documents from data sources and files, then updates the index for * retrieval. */ + @Deprecated("deprecated") fun create(pipelineId: String): Pipeline = create(pipelineId, SyncCreateParams.none()) /** @see create */ + @Deprecated("deprecated") fun create( pipelineId: String, params: SyncCreateParams = SyncCreateParams.none(), @@ -41,26 +43,32 @@ interface SyncService { ): Pipeline = create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") fun create(pipelineId: String, params: SyncCreateParams = SyncCreateParams.none()): Pipeline = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create( params: SyncCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** @see create */ + @Deprecated("deprecated") fun create(params: SyncCreateParams): Pipeline = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") fun create(pipelineId: String, requestOptions: RequestOptions): Pipeline = create(pipelineId, SyncCreateParams.none(), requestOptions) /** Cancel all running sync jobs for a pipeline. */ + @Deprecated("deprecated") fun cancel(pipelineId: String): Pipeline = cancel(pipelineId, SyncCancelParams.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( pipelineId: String, params: SyncCancelParams = SyncCancelParams.none(), @@ -68,19 +76,23 @@ interface SyncService { ): Pipeline = cancel(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see cancel */ + @Deprecated("deprecated") fun cancel(pipelineId: String, params: SyncCancelParams = SyncCancelParams.none()): Pipeline = cancel(pipelineId, params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel( params: SyncCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): Pipeline /** @see cancel */ + @Deprecated("deprecated") fun cancel(params: SyncCancelParams): Pipeline = cancel(params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") fun cancel(pipelineId: String, requestOptions: RequestOptions): Pipeline = cancel(pipelineId, SyncCancelParams.none(), requestOptions) @@ -98,11 +110,13 @@ interface SyncService { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/sync`, but is * otherwise the same as [SyncService.create]. */ + @Deprecated("deprecated") @MustBeClosed fun create(pipelineId: String): HttpResponseFor = create(pipelineId, SyncCreateParams.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -112,6 +126,7 @@ interface SyncService { create(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( pipelineId: String, @@ -119,6 +134,7 @@ interface SyncService { ): HttpResponseFor = create(pipelineId, params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create( params: SyncCreateParams, @@ -126,11 +142,13 @@ interface SyncService { ): HttpResponseFor /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create(params: SyncCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ + @Deprecated("deprecated") @MustBeClosed fun create(pipelineId: String, requestOptions: RequestOptions): HttpResponseFor = create(pipelineId, SyncCreateParams.none(), requestOptions) @@ -139,11 +157,13 @@ interface SyncService { * Returns a raw HTTP response for `post /api/v1/pipelines/{pipeline_id}/sync/cancel`, but * is otherwise the same as [SyncService.cancel]. */ + @Deprecated("deprecated") @MustBeClosed fun cancel(pipelineId: String): HttpResponseFor = cancel(pipelineId, SyncCancelParams.none()) /** @see cancel */ + @Deprecated("deprecated") @MustBeClosed fun cancel( pipelineId: String, @@ -153,6 +173,7 @@ interface SyncService { cancel(params.toBuilder().pipelineId(pipelineId).build(), requestOptions) /** @see cancel */ + @Deprecated("deprecated") @MustBeClosed fun cancel( pipelineId: String, @@ -160,6 +181,7 @@ interface SyncService { ): HttpResponseFor = cancel(pipelineId, params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") @MustBeClosed fun cancel( params: SyncCancelParams, @@ -167,11 +189,13 @@ interface SyncService { ): HttpResponseFor /** @see cancel */ + @Deprecated("deprecated") @MustBeClosed fun cancel(params: SyncCancelParams): HttpResponseFor = cancel(params, RequestOptions.none()) /** @see cancel */ + @Deprecated("deprecated") @MustBeClosed fun cancel(pipelineId: String, requestOptions: RequestOptions): HttpResponseFor = cancel(pipelineId, SyncCancelParams.none(), requestOptions) diff --git a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncServiceImpl.kt b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncServiceImpl.kt index be822ae..f58a993 100644 --- a/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncServiceImpl.kt +++ b/llama-cloud-java-core/src/main/kotlin/com/llamacloud_prod/api/services/blocking/pipelines/SyncServiceImpl.kt @@ -33,10 +33,12 @@ class SyncServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withOptions(modifier: Consumer): SyncService = SyncServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + @Deprecated("deprecated") override fun create(params: SyncCreateParams, requestOptions: RequestOptions): Pipeline = // post /api/v1/pipelines/{pipeline_id}/sync withRawResponse().create(params, requestOptions).parse() + @Deprecated("deprecated") override fun cancel(params: SyncCancelParams, requestOptions: RequestOptions): Pipeline = // post /api/v1/pipelines/{pipeline_id}/sync/cancel withRawResponse().cancel(params, requestOptions).parse() @@ -57,6 +59,7 @@ class SyncServiceImpl internal constructor(private val clientOptions: ClientOpti private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun create( params: SyncCreateParams, requestOptions: RequestOptions, @@ -88,6 +91,7 @@ class SyncServiceImpl internal constructor(private val clientOptions: ClientOpti private val cancelHandler: Handler = jsonHandler(clientOptions.jsonMapper) + @Deprecated("deprecated") override fun cancel( params: SyncCancelParams, requestOptions: RequestOptions, diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSourceTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSourceTest.kt index a7a069d..18d1f14 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSourceTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/CloudConfluenceDataSourceTest.kt @@ -25,6 +25,7 @@ internal class CloudConfluenceDataSourceTest { .pageIds("page_ids") .spaceKey("space_key") .supportsAccessControl(true) + .syncPermissions(true) .userName("user_name") .build() @@ -42,6 +43,7 @@ internal class CloudConfluenceDataSourceTest { assertThat(cloudConfluenceDataSource.pageIds()).contains("page_ids") assertThat(cloudConfluenceDataSource.spaceKey()).contains("space_key") assertThat(cloudConfluenceDataSource.supportsAccessControl()).contains(true) + assertThat(cloudConfluenceDataSource.syncPermissions()).contains(true) assertThat(cloudConfluenceDataSource.userName()).contains("user_name") } @@ -62,6 +64,7 @@ internal class CloudConfluenceDataSourceTest { .pageIds("page_ids") .spaceKey("space_key") .supportsAccessControl(true) + .syncPermissions(true) .userName("user_name") .build() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2ParametersTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2ParametersTest.kt index bd53c9c..abcb5fd 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2ParametersTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/configurations/ParseV2ParametersTest.kt @@ -41,6 +41,11 @@ internal class ParseV2ParametersTest { .removeNavigationElements(true) .build() ) + .image( + ParseV2Parameters.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParseV2Parameters.InputOptions.Presentation.builder() @@ -314,6 +319,11 @@ internal class ParseV2ParametersTest { .removeNavigationElements(true) .build() ) + .image( + ParseV2Parameters.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParseV2Parameters.InputOptions.Presentation.builder() @@ -587,6 +597,11 @@ internal class ParseV2ParametersTest { .removeNavigationElements(true) .build() ) + .image( + ParseV2Parameters.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParseV2Parameters.InputOptions.Presentation.builder() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParamsTest.kt index bc3ba14..50fca59 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParamsTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/parsing/ParsingCreateParamsTest.kt @@ -21,6 +21,7 @@ internal class ParsingCreateParamsTest { ParsingCreateParams.AgenticOptions.builder().customPrompt("custom_prompt").build() ) .clientName("client_name") + .configurationId("configuration_id") .cropBox( ParsingCreateParams.CropBox.builder() .bottom(0.0) @@ -42,6 +43,11 @@ internal class ParsingCreateParamsTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() @@ -296,6 +302,7 @@ internal class ParsingCreateParamsTest { .build() ) .clientName("client_name") + .configurationId("configuration_id") .cropBox( ParsingCreateParams.CropBox.builder() .bottom(0.0) @@ -317,6 +324,11 @@ internal class ParsingCreateParamsTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() @@ -602,6 +614,7 @@ internal class ParsingCreateParamsTest { .build() ) .clientName("client_name") + .configurationId("configuration_id") .cropBox( ParsingCreateParams.CropBox.builder() .bottom(0.0) @@ -623,6 +636,11 @@ internal class ParsingCreateParamsTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() @@ -879,6 +897,7 @@ internal class ParsingCreateParamsTest { ParsingCreateParams.AgenticOptions.builder().customPrompt("custom_prompt").build() ) assertThat(body.clientName()).contains("client_name") + assertThat(body.configurationId()).contains("configuration_id") assertThat(body.cropBox()) .contains( ParsingCreateParams.CropBox.builder() @@ -902,6 +921,11 @@ internal class ParsingCreateParamsTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParamsTest.kt new file mode 100644 index 0000000..33a34fe --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetCreateParamsTest.kt @@ -0,0 +1,253 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.core.http.QueryParams +import com.llamacloud_prod.api.models.beta.sheets.SheetsParsingConfig +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetCreateParamsTest { + + @Test + fun create() { + SheetCreateParams.builder() + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("cfg-11111111-2222-3333-4444-555555555555") + .addWebhookConfiguration( + SheetCreateParams.WebhookConfiguration.builder() + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS + ) + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR + ) + .webhookHeaders( + SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() + .putAdditionalProperty("Authorization", JsonValue.from("Bearer sk-...")) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + } + + @Test + fun queryParams() { + val params = + SheetCreateParams.builder() + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("cfg-11111111-2222-3333-4444-555555555555") + .addWebhookConfiguration( + SheetCreateParams.WebhookConfiguration.builder() + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS + ) + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR + ) + .webhookHeaders( + SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + SheetCreateParams.builder().fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } + + @Test + fun body() { + val params = + SheetCreateParams.builder() + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("cfg-11111111-2222-3333-4444-555555555555") + .addWebhookConfiguration( + SheetCreateParams.WebhookConfiguration.builder() + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS + ) + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR + ) + .webhookHeaders( + SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + + val body = params._body() + + assertThat(body.fileId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.config()) + .contains( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + assertThat(body.configuration()) + .contains( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + assertThat(body.configurationId()).contains("cfg-11111111-2222-3333-4444-555555555555") + assertThat(body.webhookConfigurations().getOrNull()) + .containsExactly( + SheetCreateParams.WebhookConfiguration.builder() + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS + ) + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR + ) + .webhookHeaders( + SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() + .putAdditionalProperty("Authorization", JsonValue.from("Bearer sk-...")) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + SheetCreateParams.builder().fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val body = params._body() + + assertThat(body.fileId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParamsTest.kt new file mode 100644 index 0000000..e106593 --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobParamsTest.kt @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetDeleteJobParamsTest { + + @Test + fun create() { + SheetDeleteJobParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = SheetDeleteJobParams.builder().spreadsheetJobId("spreadsheet_job_id").build() + + assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + SheetDeleteJobParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = SheetDeleteJobParams.builder().spreadsheetJobId("spreadsheet_job_id").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponseTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponseTest.kt new file mode 100644 index 0000000..1aa01c2 --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetDeleteJobResponseTest.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.llamacloud_prod.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetDeleteJobResponseTest { + + @Test + fun create() { + val sheetDeleteJobResponse = SheetDeleteJobResponse.builder().build() + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val sheetDeleteJobResponse = SheetDeleteJobResponse.builder().build() + + val roundtrippedSheetDeleteJobResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(sheetDeleteJobResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSheetDeleteJobResponse).isEqualTo(sheetDeleteJobResponse) + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParamsTest.kt new file mode 100644 index 0000000..4ad851b --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetParamsTest.kt @@ -0,0 +1,63 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetGetParamsTest { + + @Test + fun create() { + SheetGetParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .addExpand("string") + .includeResults(true) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = SheetGetParams.builder().spreadsheetJobId("spreadsheet_job_id").build() + + assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + SheetGetParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .addExpand("string") + .includeResults(true) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("expand", "string") + .put("include_results", "true") + .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = SheetGetParams.builder().spreadsheetJobId("spreadsheet_job_id").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParamsTest.kt new file mode 100644 index 0000000..d99135f --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetGetResultTableParamsTest.kt @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetGetResultTableParamsTest { + + @Test + fun create() { + SheetGetResultTableParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .regionId("region_id") + .regionType(SheetGetResultTableParams.RegionType.TABLE) + .expiresAtSeconds(0L) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + SheetGetResultTableParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .regionId("region_id") + .regionType(SheetGetResultTableParams.RegionType.TABLE) + .build() + + assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") + assertThat(params._pathParam(1)).isEqualTo("region_id") + assertThat(params._pathParam(2)).isEqualTo("table") + // out-of-bound path param + assertThat(params._pathParam(3)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + SheetGetResultTableParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .regionId("region_id") + .regionType(SheetGetResultTableParams.RegionType.TABLE) + .expiresAtSeconds(0L) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("expires_at_seconds", "0") + .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + SheetGetResultTableParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .regionId("region_id") + .regionType(SheetGetResultTableParams.RegionType.TABLE) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponseTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponseTest.kt new file mode 100644 index 0000000..790600a --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListPageResponseTest.kt @@ -0,0 +1,412 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.core.jsonMapper +import com.llamacloud_prod.api.models.beta.sheets.SheetsJob +import com.llamacloud_prod.api.models.beta.sheets.SheetsParsingConfig +import com.llamacloud_prod.api.models.files.File +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetListPageResponseTest { + + @Test + fun create() { + val sheetListPageResponse = + SheetListPageResponse.builder() + .addItem( + SheetsJob.builder() + .id("id") + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity( + SheetsParsingConfig.TableMergeSensitivity.STRONG + ) + .useExperimentalProcessing(true) + .build() + ) + .createdAt("created_at") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SheetsJob.Status.PENDING) + .updatedAt("updated_at") + .userId("user_id") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity( + SheetsParsingConfig.TableMergeSensitivity.STRONG + ) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("configuration_id") + .addError("string") + .file( + File.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("x") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalFileId("external_file_id") + .fileSize(0L) + .fileType("x") + .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .permissionInfo( + File.PermissionInfo.builder() + .putAdditionalProperty( + "foo", + JsonValue.from(mapOf("foo" to "bar")), + ) + .build() + ) + .purpose("purpose") + .resourceInfo( + File.ResourceInfo.builder() + .putAdditionalProperty( + "foo", + JsonValue.from(mapOf("foo" to "bar")), + ) + .build() + ) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .metadataStateTransitions( + SheetsJob.MetadataStateTransitions.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .parameters( + SheetsJob.Parameters.builder() + .addWebhookConfiguration( + SheetsJob.Parameters.WebhookConfiguration.builder() + .addWebhookEvent( + SheetsJob.Parameters.WebhookConfiguration.WebhookEvent + .PARSE_SUCCESS + ) + .addWebhookEvent( + SheetsJob.Parameters.WebhookConfiguration.WebhookEvent + .PARSE_ERROR + ) + .webhookHeaders( + SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders + .builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + ) + .addRegion( + SheetsJob.Region.builder() + .location("location") + .regionType("region_type") + .sheetName("sheet_name") + .description("description") + .regionId("region_id") + .title("title") + .build() + ) + .success(true) + .addWorksheetMetadata( + SheetsJob.WorksheetMetadata.builder() + .sheetName("sheet_name") + .description("description") + .title("title") + .build() + ) + .build() + ) + .nextPageToken("next_page_token") + .totalSize(0L) + .build() + + assertThat(sheetListPageResponse.items()) + .containsExactly( + SheetsJob.builder() + .id("id") + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .createdAt("created_at") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SheetsJob.Status.PENDING) + .updatedAt("updated_at") + .userId("user_id") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("configuration_id") + .addError("string") + .file( + File.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("x") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalFileId("external_file_id") + .fileSize(0L) + .fileType("x") + .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .permissionInfo( + File.PermissionInfo.builder() + .putAdditionalProperty( + "foo", + JsonValue.from(mapOf("foo" to "bar")), + ) + .build() + ) + .purpose("purpose") + .resourceInfo( + File.ResourceInfo.builder() + .putAdditionalProperty( + "foo", + JsonValue.from(mapOf("foo" to "bar")), + ) + .build() + ) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .metadataStateTransitions( + SheetsJob.MetadataStateTransitions.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .parameters( + SheetsJob.Parameters.builder() + .addWebhookConfiguration( + SheetsJob.Parameters.WebhookConfiguration.builder() + .addWebhookEvent( + SheetsJob.Parameters.WebhookConfiguration.WebhookEvent + .PARSE_SUCCESS + ) + .addWebhookEvent( + SheetsJob.Parameters.WebhookConfiguration.WebhookEvent + .PARSE_ERROR + ) + .webhookHeaders( + SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders + .builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + ) + .addRegion( + SheetsJob.Region.builder() + .location("location") + .regionType("region_type") + .sheetName("sheet_name") + .description("description") + .regionId("region_id") + .title("title") + .build() + ) + .success(true) + .addWorksheetMetadata( + SheetsJob.WorksheetMetadata.builder() + .sheetName("sheet_name") + .description("description") + .title("title") + .build() + ) + .build() + ) + assertThat(sheetListPageResponse.nextPageToken()).contains("next_page_token") + assertThat(sheetListPageResponse.totalSize()).contains(0L) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val sheetListPageResponse = + SheetListPageResponse.builder() + .addItem( + SheetsJob.builder() + .id("id") + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity( + SheetsParsingConfig.TableMergeSensitivity.STRONG + ) + .useExperimentalProcessing(true) + .build() + ) + .createdAt("created_at") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SheetsJob.Status.PENDING) + .updatedAt("updated_at") + .userId("user_id") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity( + SheetsParsingConfig.TableMergeSensitivity.STRONG + ) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("configuration_id") + .addError("string") + .file( + File.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("x") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalFileId("external_file_id") + .fileSize(0L) + .fileType("x") + .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .permissionInfo( + File.PermissionInfo.builder() + .putAdditionalProperty( + "foo", + JsonValue.from(mapOf("foo" to "bar")), + ) + .build() + ) + .purpose("purpose") + .resourceInfo( + File.ResourceInfo.builder() + .putAdditionalProperty( + "foo", + JsonValue.from(mapOf("foo" to "bar")), + ) + .build() + ) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .metadataStateTransitions( + SheetsJob.MetadataStateTransitions.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .parameters( + SheetsJob.Parameters.builder() + .addWebhookConfiguration( + SheetsJob.Parameters.WebhookConfiguration.builder() + .addWebhookEvent( + SheetsJob.Parameters.WebhookConfiguration.WebhookEvent + .PARSE_SUCCESS + ) + .addWebhookEvent( + SheetsJob.Parameters.WebhookConfiguration.WebhookEvent + .PARSE_ERROR + ) + .webhookHeaders( + SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders + .builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + ) + .addRegion( + SheetsJob.Region.builder() + .location("location") + .regionType("region_type") + .sheetName("sheet_name") + .description("description") + .regionId("region_id") + .title("title") + .build() + ) + .success(true) + .addWorksheetMetadata( + SheetsJob.WorksheetMetadata.builder() + .sheetName("sheet_name") + .description("description") + .title("title") + .build() + ) + .build() + ) + .nextPageToken("next_page_token") + .totalSize(0L) + .build() + + val roundtrippedSheetListPageResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(sheetListPageResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSheetListPageResponse).isEqualTo(sheetListPageResponse) + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParamsTest.kt new file mode 100644 index 0000000..06c0060 --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/models/sheets/SheetListParamsTest.kt @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.models.sheets + +import com.llamacloud_prod.api.core.http.QueryParams +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SheetListParamsTest { + + @Test + fun create() { + SheetListParams.builder() + .configurationId("configuration_id") + .createdAtOnOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtOnOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .includeResults(true) + .addJobId("string") + .addJobId("string") + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pageSize(0L) + .pageToken("page_token") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SheetListParams.Status.PENDING) + .build() + } + + @Test + fun queryParams() { + val params = + SheetListParams.builder() + .configurationId("configuration_id") + .createdAtOnOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtOnOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .includeResults(true) + .addJobId("string") + .addJobId("string") + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pageSize(0L) + .pageToken("page_token") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SheetListParams.Status.PENDING) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("configuration_id", "configuration_id") + .put("created_at_on_or_after", "2019-12-27T18:11:19.117Z") + .put("created_at_on_or_before", "2019-12-27T18:11:19.117Z") + .put("include_results", "true") + .put("job_ids", "string") + .put("job_ids", "string") + .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("page_size", "0") + .put("page_token", "page_token") + .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("status", "PENDING") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = SheetListParams.builder().build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt index d172451..7c4ecab 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt @@ -84,6 +84,7 @@ internal class ServiceParamsTest { .build() ) .clientName("client_name") + .configurationId("configuration_id") .cropBox( ParsingCreateParams.CropBox.builder() .bottom(0.0) @@ -105,6 +106,11 @@ internal class ServiceParamsTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/ParsingServiceAsyncTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/ParsingServiceAsyncTest.kt index 3043538..b4ffd62 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/ParsingServiceAsyncTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/ParsingServiceAsyncTest.kt @@ -31,6 +31,7 @@ internal class ParsingServiceAsyncTest { .build() ) .clientName("client_name") + .configurationId("configuration_id") .cropBox( ParsingCreateParams.CropBox.builder() .bottom(0.0) @@ -52,6 +53,11 @@ internal class ParsingServiceAsyncTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncTest.kt new file mode 100644 index 0000000..5071d3f --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/async/SheetServiceAsyncTest.kt @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.services.async + +import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClientAsync +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.models.beta.sheets.SheetsParsingConfig +import com.llamacloud_prod.api.models.sheets.SheetCreateParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobParams +import com.llamacloud_prod.api.models.sheets.SheetGetParams +import com.llamacloud_prod.api.models.sheets.SheetGetResultTableParams +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test + +internal class SheetServiceAsyncTest { + + @Disabled("Mock server tests are disabled") + @Test + fun create() { + val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() + val sheetServiceAsync = client.sheets() + + val sheetsJobFuture = + sheetServiceAsync.create( + SheetCreateParams.builder() + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("cfg-11111111-2222-3333-4444-555555555555") + .addWebhookConfiguration( + SheetCreateParams.WebhookConfiguration.builder() + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS + ) + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR + ) + .webhookHeaders( + SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + ) + + val sheetsJob = sheetsJobFuture.get() + sheetsJob.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun list() { + val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() + val sheetServiceAsync = client.sheets() + + val pageFuture = sheetServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun deleteJob() { + val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() + val sheetServiceAsync = client.sheets() + + val responseFuture = + sheetServiceAsync.deleteJob( + SheetDeleteJobParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun get() { + val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() + val sheetServiceAsync = client.sheets() + + val sheetsJobFuture = + sheetServiceAsync.get( + SheetGetParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .addExpand("string") + .includeResults(true) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val sheetsJob = sheetsJobFuture.get() + sheetsJob.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun getResultTable() { + val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() + val sheetServiceAsync = client.sheets() + + val presignedUrlFuture = + sheetServiceAsync.getResultTable( + SheetGetResultTableParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .regionId("region_id") + .regionType(SheetGetResultTableParams.RegionType.TABLE) + .expiresAtSeconds(0L) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val presignedUrl = presignedUrlFuture.get() + presignedUrl.validate() + } +} diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/ParsingServiceTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/ParsingServiceTest.kt index 2e9a1da..870c7d4 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/ParsingServiceTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/ParsingServiceTest.kt @@ -31,6 +31,7 @@ internal class ParsingServiceTest { .build() ) .clientName("client_name") + .configurationId("configuration_id") .cropBox( ParsingCreateParams.CropBox.builder() .bottom(0.0) @@ -52,6 +53,11 @@ internal class ParsingServiceTest { .removeNavigationElements(true) .build() ) + .image( + ParsingCreateParams.InputOptions.Image.builder() + .cameraPhotoCorrection(true) + .build() + ) .pdf(JsonValue.from(mapOf())) .presentation( ParsingCreateParams.InputOptions.Presentation.builder() diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceTest.kt new file mode 100644 index 0000000..2c76e92 --- /dev/null +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/blocking/SheetServiceTest.kt @@ -0,0 +1,149 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.llamacloud_prod.api.services.blocking + +import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient +import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.models.beta.sheets.SheetsParsingConfig +import com.llamacloud_prod.api.models.sheets.SheetCreateParams +import com.llamacloud_prod.api.models.sheets.SheetDeleteJobParams +import com.llamacloud_prod.api.models.sheets.SheetGetParams +import com.llamacloud_prod.api.models.sheets.SheetGetResultTableParams +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test + +internal class SheetServiceTest { + + @Disabled("Mock server tests are disabled") + @Test + fun create() { + val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() + val sheetService = client.sheets() + + val sheetsJob = + sheetService.create( + SheetCreateParams.builder() + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configuration( + SheetsParsingConfig.builder() + .extractionRange("extraction_range") + .flattenHierarchicalTables(true) + .generateAdditionalMetadata(true) + .includeHiddenCells(true) + .addSheetName("string") + .specialization("specialization") + .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .useExperimentalProcessing(true) + .build() + ) + .configurationId("cfg-11111111-2222-3333-4444-555555555555") + .addWebhookConfiguration( + SheetCreateParams.WebhookConfiguration.builder() + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS + ) + .addWebhookEvent( + SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR + ) + .webhookHeaders( + SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() + .putAdditionalProperty( + "Authorization", + JsonValue.from("Bearer sk-..."), + ) + .build() + ) + .webhookOutputFormat("json") + .webhookUrl("https://example.com/webhooks/llamacloud") + .build() + ) + .build() + ) + + sheetsJob.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun list() { + val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() + val sheetService = client.sheets() + + val page = sheetService.list() + + page.response().validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun deleteJob() { + val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() + val sheetService = client.sheets() + + val response = + sheetService.deleteJob( + SheetDeleteJobParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + response.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun get() { + val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() + val sheetService = client.sheets() + + val sheetsJob = + sheetService.get( + SheetGetParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .addExpand("string") + .includeResults(true) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + sheetsJob.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun getResultTable() { + val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() + val sheetService = client.sheets() + + val presignedUrl = + sheetService.getResultTable( + SheetGetResultTableParams.builder() + .spreadsheetJobId("spreadsheet_job_id") + .regionId("region_id") + .regionType(SheetGetResultTableParams.RegionType.TABLE) + .expiresAtSeconds(0L) + .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + presignedUrl.validate() + } +} diff --git a/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt b/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt index d35c743..46abb1b 100644 --- a/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt +++ b/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt @@ -49,6 +49,7 @@ internal class ProGuardCompatibilityTest { assertThat(client).isNotNull() assertThat(client.files()).isNotNull() + assertThat(client.sheets()).isNotNull() assertThat(client.parsing()).isNotNull() assertThat(client.extract()).isNotNull() assertThat(client.classifier()).isNotNull() From bf2e5aea1c20b379404958a5bf16cdca9171a9dd Mon Sep 17 00:00:00 2001 From: Yong Date: Thu, 18 Jun 2026 17:26:36 -0700 Subject: [PATCH 7/7] Build SDK Stainless-Generated-From: 685d00ed222124982652a7bc14b070891219d020 --- README.md | 20 +- .../api/services/ErrorHandlingTest.kt | 291 +++--------------- .../api/services/ServiceParamsTest.kt | 16 +- .../api/proguard/ProGuardCompatibilityTest.kt | 61 ++-- 4 files changed, 97 insertions(+), 291 deletions(-) diff --git a/README.md b/README.md index ef74309..fac47f8 100644 --- a/README.md +++ b/README.md @@ -271,24 +271,24 @@ To access this data, prefix any HTTP method call on a client or service with `wi ```java import com.llamacloud_prod.api.core.http.Headers; import com.llamacloud_prod.api.core.http.HttpResponseFor; -import com.llamacloud_prod.api.models.pipelines.Pipeline; -import com.llamacloud_prod.api.models.pipelines.PipelineListParams; +import com.llamacloud_prod.api.models.beta.indexes.IndexListPage; +import com.llamacloud_prod.api.models.beta.indexes.IndexListParams; -PipelineListParams params = PipelineListParams.builder() +IndexListParams params = IndexListParams.builder() .projectId("my-project-id") .build(); -HttpResponseFor> pipelines = client.pipelines().withRawResponse().list(params); +HttpResponseFor page = client.beta().indexes().withRawResponse().list(params); -int statusCode = pipelines.statusCode(); -Headers headers = pipelines.headers(); +int statusCode = page.statusCode(); +Headers headers = page.headers(); ``` You can still deserialize the response into an instance of a Java class if needed: ```java -import com.llamacloud_prod.api.models.pipelines.Pipeline; +import com.llamacloud_prod.api.models.beta.indexes.IndexListPage; -List parsedPipelines = pipelines.parse(); +IndexListPage parsedPage = page.parse(); ``` ## Error handling @@ -497,9 +497,9 @@ Requests time out after 1 minute by default. To set a custom timeout, configure the method call using the `timeout` method: ```java -import com.llamacloud_prod.api.models.pipelines.Pipeline; +import com.llamacloud_prod.api.models.beta.indexes.IndexListPage; -List pipelines = client.pipelines().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()); +IndexListPage page = client.beta().indexes().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()); ``` Or configure the default for all method calls at the client level: diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ErrorHandlingTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ErrorHandlingTest.kt index 458e41d..cb5b729 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ErrorHandlingTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ErrorHandlingTest.kt @@ -22,8 +22,6 @@ import com.llamacloud_prod.api.errors.RateLimitException import com.llamacloud_prod.api.errors.UnauthorizedException import com.llamacloud_prod.api.errors.UnexpectedStatusCodeException import com.llamacloud_prod.api.errors.UnprocessableEntityException -import com.llamacloud_prod.api.models.pipelines.PipelineListParams -import com.llamacloud_prod.api.models.pipelines.PipelineType import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach @@ -60,8 +58,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList400() { - val pipelineService = client.pipelines() + fun indexesList400() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -69,18 +67,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(400) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -88,8 +75,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList400WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList400WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -97,18 +84,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(400) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -116,8 +92,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList401() { - val pipelineService = client.pipelines() + fun indexesList401() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -125,18 +101,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(401) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -144,8 +109,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList401WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList401WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -153,18 +118,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(401) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -172,8 +126,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList403() { - val pipelineService = client.pipelines() + fun indexesList403() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -181,18 +135,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(403) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -200,8 +143,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList403WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList403WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -209,18 +152,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(403) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -228,8 +160,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList404() { - val pipelineService = client.pipelines() + fun indexesList404() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -237,18 +169,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(404) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -256,8 +177,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList404WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList404WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -265,18 +186,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(404) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -284,8 +194,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList422() { - val pipelineService = client.pipelines() + fun indexesList422() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -293,18 +203,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(422) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -312,8 +211,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList422WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList422WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -321,18 +220,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(422) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -340,8 +228,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList429() { - val pipelineService = client.pipelines() + fun indexesList429() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -349,18 +237,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(429) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -368,8 +245,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList429WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList429WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -377,18 +254,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(429) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -396,8 +262,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList500() { - val pipelineService = client.pipelines() + fun indexesList500() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -405,18 +271,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(500) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -424,8 +279,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList500WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList500WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -433,18 +288,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(500) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -452,8 +296,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList999() { - val pipelineService = client.pipelines() + fun indexesList999() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn( @@ -461,18 +305,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(999) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -480,8 +313,8 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesList999WithRawResponse() { - val pipelineService = client.pipelines().withRawResponse() + fun indexesList999WithRawResponse() { + val indexService = client.beta().indexes().withRawResponse() stubFor( get(anyUrl()) .willReturn( @@ -489,18 +322,7 @@ internal class ErrorHandlingTest { ) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e.statusCode()).isEqualTo(999) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -508,25 +330,14 @@ internal class ErrorHandlingTest { } @Test - fun pipelinesListInvalidJsonBody() { - val pipelineService = client.pipelines() + fun indexesListInvalidJsonBody() { + val indexService = client.beta().indexes() stubFor( get(anyUrl()) .willReturn(status(200).withHeader(HEADER_NAME, HEADER_VALUE).withBody(NOT_JSON)) ) - val e = - assertThrows { - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") - .build() - ) - } + val e = assertThrows { indexService.list() } assertThat(e).hasMessage("Error reading response") } diff --git a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt index 7c4ecab..cda692d 100644 --- a/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt +++ b/llama-cloud-java-core/src/test/kotlin/com/llamacloud_prod/api/services/ServiceParamsTest.kt @@ -17,10 +17,9 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.llamacloud_prod.api.client.LlamaCloudClient import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient import com.llamacloud_prod.api.core.JsonValue +import com.llamacloud_prod.api.models.beta.indexes.IndexListParams import com.llamacloud_prod.api.models.parsing.ParsingCreateParams import com.llamacloud_prod.api.models.parsing.ParsingLanguages -import com.llamacloud_prod.api.models.pipelines.PipelineListParams -import com.llamacloud_prod.api.models.pipelines.PipelineType import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -44,16 +43,11 @@ internal class ServiceParamsTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val pipelineService = client.pipelines() - stubFor(get(anyUrl()).willReturn(ok("[]"))) + val indexService = client.beta().indexes() + stubFor(get(anyUrl()).willReturn(ok("{}"))) - pipelineService.list( - PipelineListParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pipelineName("pipeline_name") - .pipelineType(PipelineType.PLAYGROUND) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectName("project_name") + indexService.list( + IndexListParams.builder() .putAdditionalHeader("Secret-Header", "42") .putAdditionalQueryParam("secret_query_param", "42") .build() diff --git a/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt b/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt index 46abb1b..8eb8c0c 100644 --- a/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt +++ b/llama-cloud-java-proguard-test/src/test/kotlin/com/llamacloud_prod/api/proguard/ProGuardCompatibilityTest.kt @@ -4,9 +4,11 @@ package com.llamacloud_prod.api.proguard import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient +import com.llamacloud_prod.api.core.JsonValue import com.llamacloud_prod.api.core.jsonMapper -import com.llamacloud_prod.api.models.pipelines.AdvancedModeTransformConfig -import com.llamacloud_prod.api.models.pipelines.MessageRole +import com.llamacloud_prod.api.models.beta.indexes.IndexCreateResponse +import com.llamacloud_prod.api.models.parsing.FailPageMode +import java.time.OffsetDateTime import kotlin.reflect.full.memberFunctions import kotlin.reflect.jvm.javaMethod import org.assertj.core.api.Assertions.assertThat @@ -65,49 +67,48 @@ internal class ProGuardCompatibilityTest { } @Test - fun advancedModeTransformConfigRoundtrip() { + fun indexCreateResponseRoundtrip() { val jsonMapper = jsonMapper() - val advancedModeTransformConfig = - AdvancedModeTransformConfig.builder() - .chunkingConfig( - AdvancedModeTransformConfig.ChunkingConfig.NoneChunkingConfig.builder() - .mode( - AdvancedModeTransformConfig.ChunkingConfig.NoneChunkingConfig.Mode.NONE - ) - .build() - ) - .mode(AdvancedModeTransformConfig.Mode.ADVANCED) - .segmentationConfig( - AdvancedModeTransformConfig.SegmentationConfig.NoneSegmentationConfig.builder() - .mode( - AdvancedModeTransformConfig.SegmentationConfig.NoneSegmentationConfig - .Mode - .NONE - ) + val indexCreateResponse = + IndexCreateResponse.builder() + .id("id") + .exportConfigId("export_config_id") + .name("name") + .projectId("project_id") + .sourceDirectoryId("source_directory_id") + .syncConfigId("sync_config_id") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .description("description") + .lastExportedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .lastSyncedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .metadata( + IndexCreateResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() - val roundtrippedAdvancedModeTransformConfig = + val roundtrippedIndexCreateResponse = jsonMapper.readValue( - jsonMapper.writeValueAsString(advancedModeTransformConfig), - jacksonTypeRef(), + jsonMapper.writeValueAsString(indexCreateResponse), + jacksonTypeRef(), ) - assertThat(roundtrippedAdvancedModeTransformConfig).isEqualTo(advancedModeTransformConfig) + assertThat(roundtrippedIndexCreateResponse).isEqualTo(indexCreateResponse) } @Test - fun messageRoleRoundtrip() { + fun failPageModeRoundtrip() { val jsonMapper = jsonMapper() - val messageRole = MessageRole.SYSTEM + val failPageMode = FailPageMode.RAW_TEXT - val roundtrippedMessageRole = + val roundtrippedFailPageMode = jsonMapper.readValue( - jsonMapper.writeValueAsString(messageRole), - jacksonTypeRef(), + jsonMapper.writeValueAsString(failPageMode), + jacksonTypeRef(), ) - assertThat(roundtrippedMessageRole).isEqualTo(messageRole) + assertThat(roundtrippedFailPageMode).isEqualTo(failPageMode) } }